int state;
// the setup funtion runs once when you press reset and or power the board
void setup() {
//Define Pins
#define LED D0
#define button 27
//Initilize pins
pinMode(LED, INPUT); // Define button as an input
pinMode(button, OUTPUT); // Define LED as an ouput
}
// the loop funtion runs over and over again forever
void loop() {
state=digitalRead(button);
//Write a Pin
if(state==HIGH) //
{
digitalWrite(LED,HIGH); // If the button is pressed, the LED lights up
}
else{
digitalWrite(LED,LOW); // If the button is released, the LED turns off
}
}
A R D U I N O