martin-ger / esp_mqtt

MQTT Broker/Bridge on the ESP8266
MIT License
295 stars 69 forks source link

enable PWM function? #4

Closed kim-rok closed 6 years ago

kim-rok commented 6 years ago

What a nice project! my project need PWM control. So how can I enable PWM function? And where can I get the documents about scripting language used in "script.pir" and "script.sonoff"?

martin-ger commented 6 years ago

Sorry, currently there is no more written documentation on the scripting language available than the README. Once consolidated, I will work on this.

Also, there is no buildin PWM support. Guess, it would need an additional pin definition command (like "pinmode input") and a new output action (like "gpio_out"). Both canbe added to"lang.c" (see line 839 ff.). Will think about this for the next release.

martin-ger commented 6 years ago

Added PWM: Try "gpio_pwm " in a script. is the GPIO number, a value between 0 and 1000. There is no need to initialize the pin before, but it cannot be used any more for interrupts or binary i/o in the same script.

martin-ger commented 6 years ago

Added a sample in the "scripts" directory.

martin-ger commented 6 years ago

Added a decription of the scripting language here; https://github.com/martin-ger/esp_mqtt/blob/master/SCRIPTING.md