arduino serial read write structure
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
if (Serial.available()) {
char data = Serial.read(); // read the incoming data
Serial.write(data); // send the data back
}
}