I’ve seen lots of great examples like this one i.e. click on a web page button to switch something on, it stays on until you click it off. What I haven’t yet seen and would love to see is a non-latching switch i.e. click on a button to turn something on and have it stay only as long as you hold the button. If anybody has any ideas (or better yet code) to do this, I’d really like to hear from you.
http://www.youtube.com/watch?v=ONKM5lSthNY
As you can embed jQuery on the chip (by linking to the CDN version), this is quite easy to do with the jQuery mouseDown() function:
Thanks. I’m hoping to make this work on a local network with no internet connection, is there a way of doing this that doesn’t require the ESP8266 or its client to have internet access?
That would be tough I guess, as you would need to embed the whole jQuery onto the chip …
I have started to experiment a bit, I disconnected one of my computers from any network and under those circumstances jquery fails however the ONMOUSEOVER event is part of standard javascript and it works without a network connection, I haven’t made it do exactly what I want but it’s early days and I’m hopeful.
We’ll see what happens when I put the code on to an ESP
If I read this right, you’re looking for something like this:
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onmousedown
jQuery would be way overkill
@Jim_Buzbee
That site is where I got the onmouseover idea. we’re on the same track.
You could do that with websockets as you have continuous data going back and forth…
I hope you all will indulge me as I’m a complete newbie when it comes to programming in a network environment. Any chance you could point me to some examples of that?
Not directly on the chip itself but using websockets on a Pi and having them talk to the mobile - then sending MQTT messages to your ESP boards - that is relatively easy. I agree with Marco - if you’re planning on using this internally with no external network connection (to pick up on the likes of jQuery mobile CDNs) you are likely going to have a hard time getting the ESP to do the lot - but if you can stomach having a PI doing the controlling of various little ESP boards internally then you have a lot more available power.
Maybe it would be useful if I told you what I’m trying to do. I want to make a two channel remote control where anyone with the appropriate password can log on to an access point created by the 8266 and operate the remote without having to download any software or install apps using only a browser, under most circumstances, the entire network would consist only of the 8266 server and the connected client device