int incomingByte = 0; // for incoming serial data void setup() { Serial.begin(9600); pinMode(3,OUTPUT); } void loop(){ digitalWrite(3,HIGH); ///// Get Number from processing if (Serial.available() > 0) { incomingByte = Serial.read(); // read the incoming byte: Serial.println(incomingByte); // say what you got: if( incomingByte == 5 ){ digitalWrite(3,LOW); delay(100); digitalWrite(3,HIGH); } } }