Instructions

www.joy-it.net
Pascalstr. 8 47506 Neukirchen-Vluyn
3. APPLICATION WITH THE ARDUINO
Wiring:
The following example program displays the status of the two buttons
every 2 seconds.
Arduino Button
Pin 11 S1
Pin 10 S2
5 V VCC
GND GND
//Initialisation
int Button1 = 10;
int Button2 = 11;
void setup(){
Serial.begin(9600);
pinMode(Button1,INPUT);
pinMode(Button2,INPUT);
}
//Button-Query
void loop(){
if (digitalRead(Button1) == HIGH){
Serial.println("Button 1 pressed");
}
else{
Serial.println ("Button 1 not pressed");
}
if (digitalRead(Button2) == HIGH){
Serial.println("Button 2 pressed");
}
else{
Serial.println ("Button 2 not pressed");
}
Serial.println ("----------------------------");
delay(2000);
}