Esp8266
From James's Wiki
here is the code to forward data from one serial port to another on a arduino mega to communicate with the esp8266
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial1.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Startup Complete.");
}
void loop() {
// put your main code here, to run repeatedly:
if ( Serial1.available() ) { Serial.write( Serial1.read() ); }
if ( Serial.available() ) { Serial1.write( Serial.read() ); }
}