Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By luc VdV
#38590 With a small change, you don't have the problem with the delay-time.

serialprintln "created with esp basic 1.76"
interrupt 0 [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


This works much smoother. Remember to adjust the IP on the last 2 lines.
And with a small adjustment on the receiving-side it works as a on-off remote switch.

serialprintln "created with esp basic 1.76"
let status2 = 0
po 2 status2
msgbranch [doit]
wait

[doit]
msgget stat s
if s=1 then goto [doit_exit]
if status2 = 0 then goto [doit_make_hi]
let status2 = 0
po 2 status2
goto [doit_exit]
[doit_make_hi]
let status2 = 1
po 2 status2

[doit_exit]
msgreturn s
wait
User avatar
By forlotto
#41565 using interrupts now you could have a nodemcu to nodemcu remote to preform whatever task at the push of a button wow hrmmmm very nice don't you folks think?

Remote controlled push button node mcu to node mcu...

Might be interesting for a dimmer or a garage door or a light etc if interrupted open garage door or if interrupt check register if register is above zero decrease the step in pwm dimming if register is zero for the count of interrupts then go to brightest setting rather than zero or off.

hrmmmm excellent think of the possible incantations of code one could come up with all done via the push of a single button.
User avatar
By hajo
#56556 I tried to transfer the example to my ESP8266.

WGET("192.168.179.91") works,
WGET("192.168.179.91/msg?schalter=1") doesn't. It gives the error "Failed to reach end of input expression, likely malformed input".

If I put 192.168.179.91/msg?schalter=1 to my browser, it works.

What's the misktake, I make?

Thanks for helping,

hajo
User avatar
By hajo
#57888 Hi,
I solved it: wget is like a function. You can call it for instance by print wget(...). That way it worked with my ESP :D