Hello, i want a basic example for display text via serial A or B depending button press or not.
I follow the example of http://learn.adafruit.com/adafruit-ardu ... duino-code but with no results,
FOLLOWING CODE
void setup() {
Serial.begin(9600);
pinMode(8, INPUT_PULLUP);
}
void loop(){
if (digitalRead(8)==HIGH){
Serial.println("A");
} else {
Serial.println("B");
}
delay(300);
}
Only displays "A" on serial monitor, why ? how to reach the A or B depending on button press ?
Serial a text depending on button switch
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88089
- Joined: Sat Feb 07, 2009 10:11 am
Re: Serial a text depending on button switch
You need to connect a wire from the other side of your button to GND on the Arduino.
-
- Posts: 74
- Joined: Thu Feb 20, 2014 5:36 pm
Re: Serial a text depending on button switch
Resolved using the following config:
Please be positive and constructive with your questions and comments.