PWM fade up / down possible

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

PWM fade up / down possible

#1 Post by kr0815 » 04 Sep 2016, 14:25

I want to dimm up / down some LEDS (triggered by a PIR), connected with a FET

I saw i could send PWM values, but is it possible to send something to fade ?
maybe a rule with a counter ?

i read somewhere that the ESP8266 is not really good in pwm in generall, is it worth going on that way or better look for something completely different ?

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: PWM fade up / down possible

#2 Post by hamster » 06 Sep 2016, 18:36

Using the following fades GPIO 2 to level 0 over 1 second
http://192.168.0.44/control?cmd=PWM,2,0,1000
Using the following fades GPIO 2 to 0
Using the following GPIO 2 to level 200 over 1 second
http://192.168.0.44/control?cmd=PWM,2,200,1000

the following lua script in domoticz works really well.

Code: Select all

commandArray = {}
-- Check for wifidimmer changed
DomDevice = 'wifidimmer'
for i, v in pairs(devicechanged) do
   if (i == DomDevice) then
      if (v == 'Off') then DomValue = 0
         commandArray['OpenURL']='http://192.168.0.44/control?cmd=PWM,0,0,1048'
        print("wifidim1-off")
      else
         DomValue = otherdevices_svalues[DomDevice]
         CalcValue = (DomValue*6.5 - 5.5)
         print(CalcValue)
         url= 'http://192.168.0.44/control?cmd=PWM,0,' ..(CalcValue).. ',1048'
         print (url);
                print ("Dimming1 "  .. (DomDevice) .. " to " .. (CalcValue) .. " ");
         --commandArray['SendNotification']="test"
         commandArray['OpenURL']= url
      end
   end
end

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests