Skip to content

Instantly share code, notes, and snippets.

@drewgates
Last active February 10, 2017 00:37
Show Gist options
  • Select an option

  • Save drewgates/ba511c7465d47f702ecf6a8c58f24569 to your computer and use it in GitHub Desktop.

Select an option

Save drewgates/ba511c7465d47f702ecf6a8c58f24569 to your computer and use it in GitHub Desktop.
Sonoff ESPBasic Switch Simple Control
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
@drewgates

Copy link
Copy Markdown
Author

Module crashes when I attempt to turn on pin 6. Possibly not enough power with test setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment