martin-ger / esp_mqtt

MQTT Broker/Bridge on the ESP8266
MIT License
293 stars 68 forks source link

Sonoff: using GPIO1 and GPIO3 #28

Closed msillano closed 6 years ago

msillano commented 6 years ago

One more question: there is in sp_mqtt a configuration that leaves the GPIO1 (tx) and GPIO3 (rx) totally free ? So they can be used as generic I/O by the user on script? With Sonoff you do not have many pins available :)

Thanks, regards Marco

martin-ger commented 6 years ago

Yes, you can: Set system_output to 0,this disables all system and script output to serial. Then set the pinmode and use the GPIO commands as usual.

Telnet to port 7777 still gives you access to the CLI.

% Config params, overwrite any previous settings from the commandline
config system_output 0

on init
do
    gpio_pinmode 1 input pullup
    gpio_pinmode 3 input pullup

on gpio_interrupt 1 pullup
do
    println "Interrupt GPIO 1: " | $this_gpio

on gpio_interrupt 3 pullup
do
    println "Interrupt GPIO 3: " | $this_gpio
msillano commented 6 years ago

Thanks, that will be useful.

Hope you like see a first application: https://www.hackster.io/msillano/adding-a-remote-switch-to-sonoff-one-pin-for-switch-led

Thanks for the support. Best regards, Marco

martin-ger commented 6 years ago

Thanks for the project description. Nice device.

And also always love to read about applications of my SW.

Best regards, Martin

msillano commented 6 years ago

Mistake : Confused pins sorry Marco