same wiring. did this. not working
#define BUTTON1 13
int buttonValue1 = 0;
int buttonValue2 = 0;
void setup(){
pinMode(BUTTON1, INPUT);
digitalWrite(BUTTON1, HIGH);
Serial.begin(9600);
}
void loop(){
buttonValue1 = digitalRead(BUTTON1);
if(buttonValue1 == HIGH){
Serial.println("OINK");
delay(10);
}
}
EDIT
have this now. but it perpetually prints "OINK" without me pushing the button.
#define BUTTON1 13
#define BUTTON2 12
int buttonValue1 = 0;
void setup(){
pinMode(BUTTON2, INPUT);
digitalWrite(BUTTON1, HIGH);
Serial.begin(9600);
}
void loop(){
buttonValue1 = digitalRead(BUTTON2);
if(buttonValue1 == HIGH){
Serial.println("OINK");
delay(10);
}
}