Arduino command "forwarder"
Posted: Sat Nov 29, 2014 6:30 am
Hi everyone,
i just wanted to share this little sketch i wrote, which FW commands from Serial to ESP and prints the output on the Serial.
So you can have arduino connected with the usb and use the "Serial monitor" as a coolTerm or Realterm.
the hookup :
ESP TX,RX to arduino ports 10,11
ESP CH_PD&VCC to arduino 3V3
ESP GND to arduino GND
Hope you will find it usefull.
KR,
Mario
i just wanted to share this little sketch i wrote, which FW commands from Serial to ESP and prints the output on the Serial.
So you can have arduino connected with the usb and use the "Serial monitor" as a coolTerm or Realterm.
the hookup :
ESP TX,RX to arduino ports 10,11
ESP CH_PD&VCC to arduino 3V3
ESP GND to arduino GND
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial esp(10,11); //ESP firmware has to be 0018000902 so the baudrate can be set to 9600
String str; //serial input&output
String stresp; //ESP input& output
void setup()
{
Serial.begin(9600);
esp.begin(9600);
}
void loop()
{
Serial.println("unesi komandu/fire the AT command");
delay(100);
while(Serial.available() == 0){}
str=Serial.readString();
esp.println(str);
while(esp.available() == 0){}
stresp=esp.readString();
Serial.println(stresp);
}
Hope you will find it usefull.
KR,
Mario