int ledpin =22;// define pin 10 for LED
int button =18;// define pin 5 for Push Button
int val;// Define the variable value
void setup()
{
pinMode(ledpin, OUTPUT);// define LED as output
pinMode(button, INPUT);// define button as input
}
void loop()
{
val = digitalRead(button);//Read digital pin 5 level value assign
if (val==1)// Test button is pressed
{
digitalWrite(ledpin, HIGH);
}
else
{
digitalWrite(ledpin, LOW);
}
}