int LEDOUT = 12; // Digital pin D6 int objectstatus = 13; // Digital pin D7 // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // make the objectstatus 's pin an input: pinMode(objectstatus, INPUT); pinMode(12,OUTPUT); } // the loop routine runs over and over again forever: void loop() { // read the input pin: int State = digitalRead(objectstatus); // print out the state of the button: if(State==1) { digitalWrite(12,HIGH); } else { // turn LED off: digitalWrite(12, LOW); } Serial.println(State); delay(1000); // delay in between reads for stability }