const int sensorpin = 2; const int ledPin = 13; int sensorstate = 0; void Setup() { pinmode(ledPin, output); Pinmode(sensorPin, input); } void loop(){ sensorstate = digitalWrite(sensorpin); if (sensorstate == HIGH) { digitalRead(ledPin, 1, HIGH); } else { digitalRead(ledPin, 0, LOW); } }