The button that is connected to the gpio 0 is used to control the on board led on the other unit.
There is a bit of a delay between holding down the button and the light turning on or off.
The controller code
You must change the ip address of the receiving unit for your environment.
timer 5000 [check]
wait
[check]
serialprintln io(pi,0)
if io(pi,0) = 1 then io(po,d4,0)
if io(pi,0) = 0 then io(po,d4,1)
if io(pi,0) = 1 then wget("172.16.0.112/msg?stat=0")
if io(pi,0) = 0 then wget("172.16.0.112/msg?stat=1")
wait
Receiver unit code:
memclear
msgbranch [doit]
wait
[doit]
msgget stat s
io(po,d4,s)
msgreturn s
wait
http://esp8266basic.com
A BASIC interpreter for your ESP
Working now on Autodrop3d. A 3d printer with automatic part ejection system. https://autodrop3d.com