int val = 0; int incoming1 = 0; int incoming = 0; boolean send1 = false; boolean rec1 = false; boolean rec2 = false; void setup() /****** SETUP: RUNS ONCE ******/ { Serial.begin(115200); //Serial1.begin(115200); Serial.println("Serial Monitor Connected"); Serial.parseInt(); //clear any garbage in the buffer. } void loop() { if(!send1) { Serial.print(11); send1 = true; } else { if(!rec1) { CheckForMessage(); } else { if(!rec2) { CheckForMessage2(); } } } } void CheckForMessage() { incoming = Serial.available(); while(incoming != 0) //While there is something to be read { val = Serial.parseInt(); //returns the first valid integer value received Serial.print(".received info...check value."); Serial.print(val); // send confirmation to Uno Serial.println(val); if(val == 6) { Serial.println("received first msg from Uno"); rec1 = true; } incoming = Serial.available(); } } void CheckForMessage2() { incoming = Serial.available(); while(incoming != 0) //While there is something to be read { val = Serial.parseInt(); //Get new value Serial.println(".received info...check value."); Serial.print(val); // send confirmation to Uno Serial.println(val); if(val == 8) { Serial.println("received second msg from Uno"); rec1 = false; send1 = false; } incoming = Serial.available(); } }