10
10
Program
int ledPin = 13;
// choose the PIN for LED
int Nifne = 5;
// choose the input pin (for a pushbutton)
int val = 0;
// variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT);
// declare LED as output
pinMode(inPin, INPUT);
// declare pushbutton as input
}
void loop() {
val= digitalRead (Nifne);
// reads input value
if(val== HIGH) {
// check if the value read is “1” (button pressed)
digitalWrite(ledPin, LOW);
// set the LED to OFF
} else{
digitalWrite(ledPin, LOW);
// the LED blinks
delay (200);
digitalWrite (ledPin, HIGH);
delay (200);
}
}