Chat freely about anything...

User avatar
By scargill
#1234 Right.. I have managed to update the software - AND now it will update from the cloud itself - all thanks to this incredibly useful link.
http://blog.electrodragon.com/cloud-upd ... p8266-now/

I've started a blog including that link ad another. Normally with the board I have you have to keep CH_PD line high to talk to it and the rest of the control lines unconnected. To blow new firmware you have to take GPIO_0 low.

Seriously after weeks of tearing my few remaining hairs out - I've updated to the version shown in the link above.. and everything works...

AND once you set everything up - it's all held in EEPROM - so if you power the board down and back up - it will automatically reconnect to your WIFI without you having to send any code. I gave up on that daft SERIAL.FIND - it's useless if the buffer overflows and not flexible enough - so I wrote this - help yourself.

Code: Select allboolean SerialFinder(HardwareSerial &refSer, char *str,unsigned long howlong,unsigned long timeout)
{
   boolean gotit=false;
   unsigned long mytime;
   char *strtemp;
   char incoming;
   strtemp=str; mytime=millis()+howlong;
   while ((mytime>millis()) || refSer.available()) // if timer demands or there is something there
   {
    if (refSer.available())
      {
       mytime=millis()+timeout; incoming=refSer.read();
       Serial.print(incoming); // for debug
       if (incoming==*strtemp) { strtemp++; if (*strtemp==0) {strtemp=str; gotit=true; } } else strtemp=str;
      }
   }
  return gotit;
}


So for example - you're looking for "OK" - which might take up to say 4 seconds to appear - and once you have it you might want to hang around for 1 second to clear anything else from the buffer (just an example).

SerialFinder(Serial1,"OK",5000,1000);

This will wait for up to 5 seconds OR when "OK" is received - once received it will wait a further 1 second collecting and scrapping any more input - in this case also showing it on the Serial output.

I am assuming here a MEGA or similar (or 1284 chip) with more than one serial output (In the example I've used Serial and Serial1).

Hope this is useful - I will be updating my blog to give back as much as poss as I learn as I've gained so much from help in forums..

https://scargill.wordpress.com/2014/10/ ... 6-working/