Pages: [1]   Go Down
Author Topic: Uno Reset button gives value of HIGH when not pushed and LOW when pushed  (Read 248 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When the reset button on my Uno is not pushed, there is 5 volts across each side. When the button is pushed, there is 0 volts across the side with the three pins, measuring between the outside pins.

I'm a beginner, but this seems wrong. If so, how can I correct it, or is it a defect in the Uno board.

Thanks,

Dave Parsons
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That is  correct operation.
Reset pin needs to be  High for normal operations.

Time to get used to Negative logic:
High = button not pushed.
Low = button pushed.

Code:
byte pin2 = 2; // pinD2, connect button/switch from D2 to Gnd
byte ledPin = 13; // onboard LED

void setup(){
pinMode (pin2, INPUT);  // read pin D2
digitalWrite (pin2, HIGH); // enables internal pullup resistor

pinMode(ledPin, OUTPUT);  //drive on-board LED
digitalWrite(ledPin, LOW);
} // end setup

void loop(){
if (digitalRead(pin2) == LOW){  // button from pin2 to Gnd pressed?
  digitalWrite(ledPin, HIGH); // turn on on-board LED
}
else{  // turn it off
digitalWrite(ledPin, LOW);
}
} // end loop
Make sense? High is the "off" state, and Low is the "on" state
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: