const int BUTTON=2;
const int LED=0 ;
int BUTTONState=0;
void setup() {
// put your setup code here, to run once:
//delay(1000);
pinMode(LED,OUTPUT);
pinMode(BUTTON,INPUT);
digitalWrite(BUTTON,HIGH); // Have to write this pin high before entering the void loop otherwise this pin will be grounded
}
void loop() {
// put your main code here, to run repeatedly:
BUTTONState=digitalRead(BUTTON);
if(BUTTONState==HIGH)
{
digitalWrite(LED,HIGH);
}
else
{
digitalWrite(LED,LOW);
}
}