This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey everyone, I'm trying to control 8 leds via pwm, I have a script that allows the 8 channels to function through the webgui, but I can't seem to control them through console commands or MQTT.
the script was given to me and I don't understand how it works, I've spent a few days reading the Scripting and MQTT sections of the documentation but I'm struggling to comprehend it.
I compiled my own this is my user_config_override.h: "
ifndef USER_CONFIG_OVERRIDE_H
define USER_CONFIG_OVERRIDE_H
ifndef USE_SCRIPT
define USE_SCRIPT // adds about 17k flash size, variable ram size
endif
ifdef USE_RULES
undef USE_RULES
endif
define USE_SCRIPT_SUB_COMMAND
" and the script is here: "
D led1=0 led2=0 led3=0 led4=0 led5=0 led6=0 led7=0 led8=0 on1=0 on2=0 on3=0 on4=0 on5=0 on6=0 on7=0 on8=0
B ; define pwm for pins 13 to 20 with 4000 Hz pwm1(-13 4000) pwm2(-14 4000) pwm3(-15 4000) pwm4(-16 4000) pwm5(-17 4000) pwm6(-18 4000) pwm7(-19 4000) pwm8(-20 4000)
F
if on1>0 then pwm1(led1) else pwm1(0) endif
if on2>0 then pwm2(led2) else pwm2(0) endif
if on3>0 then pwm3(led3) else pwm3(0) endif
if on4>0 then pwm4(led4) else pwm4(0) endif
if on5>0 then pwm5(led5) else pwm5(0) endif
if on6>0 then pwm6(led6) else pwm6(0) endif
if on7>0 then pwm7(led7) else pwm7(0) endif
if on8>0 then pwm8(led8) else pwm8(0) endif
W bu(on1 "on" "off") sl(0 1023 led1 "0" "LED1" "100") bu(on2 "on" "off") sl(0 1023 led2 "0" "LED2" "100") bu(on3 "on" "off") sl(0 1023 led3 "0" "LED3" "100") bu(on4 "on" "off") sl(0 1023 led4 "0" "LED4" "100") bu(on5 "on" "off") sl(0 1023 led5 "0" "LED5" "100") bu(on6 "on" "off") sl(0 1023 led6 "0" "LED6" "100") bu(on7 "on" "off") sl(0 1023 led7 "0" "LED7" "100") bu(on8 "on" "off") sl(0 1023 led8 "0" "LED8" "100") "
edit reddit makes code look terrible it's posted here: https://github.com/arendst/Tasmota/discussions/10144
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/tasmota/com...