-->
Page 1 of 1

works by hands, but doesn't by code

PostPosted: Sun Dec 14, 2014 8:35 am
by juanmol
hi, i'm using this code:

#define SSID "ESSID"
#define PASS "passW0rd"
SoftwareSerial dbgSerial(1, 0); // RX, TX
int led = 4;

void setup()
{
pinMode(led, OUTPUT);
dbgSerial.begin(9600);
dbgSerial.println("AT+RST");
delay(2000);
dbgSerial.println("AT");
delay(2000);
dbgSerial.println("AT+CWMODE=3");
delay(2000);
String cmd="AT+CWJAP=\"";
cmd+=SSID;
cmd+="\",\"";
cmd+=PASS;
cmd+="\"";
dbgSerial.println(cmd);
delay(2000);

dbgSerial.println("AT+CIPMUX=1");
delay(2000);
dbgSerial.println("AT+CIPSERVER=1,80");
}
void loop()
{
code ...
}

if i connect my esp-01 to a serial-usb, and type by hand each command, it works, but if i run the code, works all except the last command, the cipserver. Have try with other port,delay, delay, new firmwares ...
By hand, cipserver works, with code it doesn't, please help me.

Re: works by hands, but doesn't by code

PostPosted: Sun Dec 14, 2014 11:21 am
by Lightning303
The delay between CWJAP and the other commands might be too short.
I got better results by using Serial.find instead of delay. Its also faster.

https://github.com/ambilight-4-mediapor ... tmoOrb.ino