int val;
void setup() {
Serial.begin(9600);
pinMode(8, INPUT);
digitalWrite(8, HIGH);
pinMode(2,OUTPUT);
// put your setup code here, to run once:
}
void loop() {
val = digitalRead(8);
Serial.print(" the butten is : ");
Serial.println(val);
if(val == 0){
digitalWrite(2, HIGH);
}
else{
digitalWrite(2, LOW);
}
// put your main code here, to run repeatedly:
}