Here is what I'm trying to do. On my model railroad layout I have a yard for holding cars. I will have 4 or 5 tracks that will have track switches to select which set of tracks the train will enter/exit. For example if I want the train to enter/leave on track 1, I would enter 11 ( depending on how this gets coded) 11 would equal 1 for the entrance switch and the other 1 is for the exit switch, which would enable the train to enter on track 1 and leave on track 1. In a similar situation if I wanted to use track 3, I would enter 77 ( depending on how this gets coded) which would enable switches 1, 2 and 3 on both ends of the yard. I need to be able to change the switches so if a train pulls in to track 1 another train will be able to leave on track 3. So once I get this straightened out then I need to work on converting this over to use buttons on the screen or a box to enter the code to select the correct track combination needed.
I personally have a web server nearby or on the internet. I use (this gets into Web coding more) that server to send this server commands. that way my ESP8266 never has to be updated. The way it works is that on my PHP page on my web server (not ESP8266) using java script, I send the ESP8266 commands. This requires some understanding of how HTTP traffic travels. You can create a nice HTML/Jquery type page on your own server (say Mac, PC or internet hosted), and it will send commands to your local ESP8266. Again, this takes some trial and error as your ESP8266 could get a new IP Address.
(I just finished similar code with jQuery mobile a few days ago to operate an ESP8266, PWM to drive a self made Lego car, with lego motor)
Example
<TABLE BORDER=1 onclick="clickthis(event)">
<TR><TD COLSPAN=5>IP 10.0.57.103</TD></TR>
<TR>
<TD ID=ALED1>On</TD>
<TD ID=ALED2>Off</TD>......</TR></TABLE>
whenever anyone clicks, or touches (I use phone) the screen, an event is triggered.
Clickthis event does some magic on the screen (light up track 1,2,3 for example on your web page)
function clickthis(ev)
{
elID = ev.target.id;
// alert(elID);
el = document.getElementById(elID);
strTxt = el.innerHTML
if (strTxt == "On") { el.innerHTML = "Off"; el.class = "Off"; el.style.backgroundColor = "white"; el.style.Color = "black"; }
else { el.innerHTML = "On"; el.class = "On"; el.style.backgroundColor = "Yellow"; el.style.Color = "Black"; }
sentData();
// if (ev.target.id
}
and senddata sends the desired control (think FIRMATA) to the ESP8266. ESP is dumb and only does what it is told. You make your website user friendly. The only catch is that the ESP and your webpage have to be accessible at the same time from your computer/device. They don't have to be in any way connected. In my case, my Website is at http://someinternetsite.com/php/leds.php and my ESP is local at 10.0.57.xxx. This uses the browser to make the ESP8266 call (see XMLHTTP below)
function sentData()
{
ledAA = 0;
ledAB = 0;
for (var i=10;i>0;i--) {
txt = document.getElementById("ALED"+i).innerHTML;
bit = 0;
if (txt == "On") bit = 1;
if (i >= 9)
{
ledAB += bit * Math.pow(2 ,(i-9));
}
else
ledAA += bit * Math.pow(2,(i-1));
}
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
var url = "http://10.0.57.103/ledtest?A=" + ledAA+ "&B=" + ledAB;
xmlhttp.open("GET", url);
xmlhttp.send("");
}
This might be a lot to absorb. It requires your intimate knowledge of JavaScript, Jquery, PHP, etc. Remember that your ESP could have many different IP Addresses, so you have to allow your webpage to somehow find it. I have not finished that part yet, but I may add an I2C OLED to the ESP so I know the IP address and that it is doing the right thing.
I will be happy to post all my code, but it is very tailored to me. If you take "senddata" part and just build a page, it is a good start. If you are able to build your website and post it, I can help finish it. It is pretty simple, just requires a lot of pre-planning. (I have seen model railroad shows, so I am aware of your situation roughly)
sa