I know that I can connect an ESP8266 with an Arduino Uno at pins 0 and 1, which is Rx and Tx, and enter commands manually in the serial monitor the commands to test it.
I had tried to use software serial and altserial to connect an ESP8266 to other pins, but it was error prone at sometimes.
My question is that how to use an automated program to control an ESP8266 when I connect the ESP8266 with an Arduino Uno at pins 0 and 1.
Sample code would be helpful.
Edit: I have added a simple program to blink led when it get response but it is not working. could you look at it too?
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(3000);
pinMode(12,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(12,LOW);
delay(2000);
Serial.println("AT");
if(Serial.available())
{
digitalWrite(12,HIGH);
while(Serial.available())
{
char c=Serial.read();
}
delay(2000);
}
}