Last active
February 10, 2017 00:37
-
-
Save drewgates/ba511c7465d47f702ecf6a8c58f24569 to your computer and use it in GitHub Desktop.
Sonoff ESPBasic Switch Simple Control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cls | |
let OutputPin = 6 | |
let LedPin = 13 | |
let PinStatus = 1 | |
let status = "off" | |
button "Toggle", [Toggle] | |
textbox status | |
interrupt 0, [Button] | |
wait | |
[Button] | |
if io(laststat,0) = 1 then wait | |
[Toggle] | |
if PinStatus == 1 then goto [On] else goto [Off] | |
[On] | |
PinStatus = 0 | |
io(po, OutputPin, 1) | |
io(po, LedPin, 0) | |
status = "on" | |
wait | |
[Off] | |
PinStatus = 1 | |
io(po, OutputPin, 0) | |
io(po, LedPin, 1) | |
status = "off" | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module crashes when I attempt to turn on pin 6. Possibly not enough power with test setup?