Sending AT commands through Arduino sketch
Posted: Wed Nov 25, 2015 9:03 pm
Hello everyone. I want to write an Arduino sketch that sends AT commands to the ESP automatically (without having to write them manually on the serial monitor). I've tryed to do this is declaring an array of strings with the AT commands:
Then writing this on the setup:
The problem is that, when I execute the program, the ESP goes crazy and it doesn't send all of the AT commands, I've tryed to fix this by putting a voltage regulator between the Arduino TX and the ESP RX, but it stills doing the same. Any help or feedback is aprecciated.
Code: Select all
String ordenes[]=
{ "AT+CWMODE=3",
"AT+CWQAP",
"AT+CWJAP=\"charly\",\"contrase\"",
"AT+CIFSR" ,
"AT+CIPMUX=1",
"AT+CIPSERVER=1,80",
"END"
};
Then writing this on the setup:
Code: Select all
int index = 0;
while(ordenes[index] != "END")
{ WIFI1.println(ordenes[index++]);
while ( true)
{ String s = GetLineWIFI();
if ( s!= "") Serial.println(s);
if ( s.startsWith("no change"))
break;
if ( s.startsWith("OK"))
break;
if ( s.startsWith("ready"))
break;
// if (millis()-T >10000) break;
}
Serial.println("....................");
}
The problem is that, when I execute the program, the ESP goes crazy and it doesn't send all of the AT commands, I've tryed to fix this by putting a voltage regulator between the Arduino TX and the ESP RX, but it stills doing the same. Any help or feedback is aprecciated.