Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By xtal
#38505 this code does not work for me on ESP-13 and ESP-201 ArduinoIDE 1.6.5
I can't determine why?
[code}
/*
test--------------
*/
String SerINP = "[c25.3/1770/43645/7.32/1.22]";
char SerialDone;
/*------------------------------------------------------------------*/
void setup()
{ Serial.begin(115200);
SerialDone == 'R'; } // enable receiving SerINP
/*-------------------------------------------------------------------*/
void loop()
{ int cycle;
Serial.println("---get serial---");
SerialDone = 'R';
SerialX();
}
/*------------------------------------------------------------------*/
String SerialX()
{
Serial.println("serial avail");
SerINP ="";
delay(1000);
}
/*------------------------------------------------------------------*/
[/code]

THIS IS WHAT HAPPENS--------------------------------------------------

---get serial---
serial avail

Exception (28):
epc1=0x40100f92 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3ffef7d0 end: 3ffef9e0 offset: 01a0

>>>stack>>>
3ffef970: 3fffdc20 3ffee9b4 402020cc 3ffee9c0
3ffef980: 40106974 3ffee9ac 000003e8 402010a3
3ffef990: 0000001c 00000000 3ffee9ac 4020304c
3ffef9a0: 0001c200 00000000 3ffee9ac 40202011
3ffef9b0: 3fffdc20 00000000 3ffee9ac 40201fad
3ffef9c0: 00000000 00000000 00000000 40202115
3ffef9d0: 00000000 00000000 3ffee9c0 40100114
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
User avatar
By martinayotte
#38507 Many "wrong" things in this code :
- the first "SerialDone == 'R';" is not assignment, because of 2 =.
- anyway, it is not used anywhere.
- same thing with SerINP, not use anywhere.
- SerialX should return a String, but there is no return statement at the end of the function.