Dimming and a rotary-encoder
Posted: 21 Aug 2017, 20:49
Is there anybody who has a example in rules how to dim a led with a Rotary encoder?
Have fun with controlling everything!
https://www.letscontrolit.com/forum/
Code: Select all
on rotary#count do
pwm,12,[rotary#count]*10 //if you want the max value to be 1000
endon
How did you came on 1000?grovkillen wrote: ↑22 Aug 2017, 19:24 I have not tested this code myself but this is how I would do it.
LED on GPIO12 (D6).
Rotary Encoder with max value 100 and min value 0, the device named "rotary" and the value named "count".
You might want to change max value to "1000" and the rule to "pwm,12,[rotary#count]" for a slower increase in light. Or if you want the max light level to be lower than that you just change the max value accordingly. You'll just have to tinker until you get the result you want.Code: Select all
on rotary#count do pwm,12,[rotary#count]*10 //if you want the max value to be 1000 endon
So now we havw control of led from encoder locally & remotely via web browser. and they are independent of each others pwm level value.on ROTARY#counter do
TaskValueSet,6,1,[ROTARY#counter]*100 //scaling (i have my scaling in device setting for encoder as 1 to 10 to make roughly 10 steps dimmer)
EXTPWM,13,[dummy#d1] // pwm level value is taken from dummy sensor value
oled,1,2,[dummy#d1] // pwm level value is taken from dummy sensor value
endon
on dimmer1 do // when above command issued from browser
TaskValueSet 6,1,%eventvalue% // store pwm level value of 0 to 1023 from above command into dummy sensor
endon
on dummy#d1 do // when above value is stored in dummy sensor
EXTPWM,13,[dummy#d1] //pwm level value is taken from dummy sensor value
oled,1,2,[dummy#d1] // pwm level value is taken from dummy sensor value
endon
where must I place dummy#d1?happytm wrote: ↑02 Sep 2017, 20:18 I use following rules to control led on my connected pro-mini.you can replace command EXTPWM,13,[dummy#d1] with
PWM,13,[dummy#d1] to control local led on esp8266.It is also controlled by web browser with event command like:
http://<espeasyip>/control?cmd=event,dimmer1=0 (lowest level) or
http://<espeasyip>/control?cmd=event,dimmer1=1023 (highest level) or any value in between.
So now we havw control of led from encoder locally & remotely via web browser. and they are independent of each others pwm level value.on ROTARY#counter do
TaskValueSet,6,1,[ROTARY#counter]*100 //scaling (i have my scaling in device setting for encoder as 1 to 10 to make roughly 10 steps dimmer)
EXTPWM,13,[dummy#d1] // pwm level value is taken from dummy sensor value
oled,1,2,[dummy#d1] // pwm level value is taken from dummy sensor value
endon
on dimmer1 do // when above command issued from browser
TaskValueSet 6,1,%eventvalue% // store pwm level value of 0 to 1023 from above command into dummy sensor
endon
on dummy#d1 do // when above value is stored in dummy sensor
EXTPWM,13,[dummy#d1] //pwm level value is taken from dummy sensor value
oled,1,2,[dummy#d1] // pwm level value is taken from dummy sensor value
endon
hope this helps.
On devices page I have setup dummy sensor as task # 6 with four values with sensor name dummy and value names as d1,d2,d3 & d4.where must I place dummy#d1?
Is that anywhere in the "Devices" menu?