Is it Christmas already?

I’m beginning to wonder if Christmas has arrived early…

I wasted the better part of yesterday getting frustrated with Lua who’d DNS lookup is extremely suspect. I have a simple time-serving web page written in PHP. It responds instantly to any call from a web browser as all it returns is a single line of information. No matter how many times I call the page it returns instantly. So I wrote a web page to grab the same information from an ESP-01 in Lua. No matter what I did, most of the time it failed, only grabbing the information perhaps one in every 10 attempts. After spending hours on this I gave up – convinced it was not my doing but that of the Lua interpreter (I should stress that Zeroday, the designer of the Lua implementation was very helpful but ultimately we got nowhere. Was it me? was it the ESP-01 or was it Lua?

I put that to one side to work on my AT code – maybe that would provide answers? Well, that worked perfectly EVERY time but a longstanding bug kept creaping in… every time I responded to a request from my Android phone with “OK” – there was a momentary loss of communication – I simply could not work it out. By mid-evening I was starting to lose heart.

I don’t know if it was the coffee kicking in but at some point a light came on – ECHO. Most AT commands result in an “OK” response from the ESP8266.. and here I am having no problems except when sending an OK to the board.. As the light began to glow, I wondered for a second… and then it all became clear – my Arduino routine for responding to input from the ESP-01 looks for OK much of the time – and the damned thing echoes my output – yes, you’ve got it – the software doesn’t know the difference between my output being echoed by the board – and that being returned from the board. I rushed off to read the manual and sure enough there’s an AT command to turn the pesky echo OFF. Why didn’t I do this in the first place !!!  My AT code works a treat – I got up early this morning to find the Android app working perfectly with the board displaying accurate time, responding to button presses and logging information with an external provider.

Wheeeeeeeeeeeeeeeee… but that still leaves the problem of the pesky Lua interpreter. If only it was open source… if only it used the latest SDK… if only…  and that’s when Nathan Cantrell on Twitter pointed out to me that indeed the Lua interpreter IS now open source and has been updated to the very latest SDK – ie 0.9.4.

Parking working AT code now – plan to integrate LCD display later today. Right now I’m going to take another look at the Lua code. Watch this space.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s