Go Down

Topic: Beginner Help - UNO Digital Pins 0, 1, 2 always high. (Read 5873 times) previous topic - next topic

zapdez

When testing the various digital I/O pins on my new Arduino Uno, I can turn of all the pins except 0, 1, 2.

For example see the basic sketch:

void setup(){
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
}

void loop(){
}
//END

After uploading this sketch, my LED on port 2 ( or when testing it on 1 or even 0),  a small glow is emitted from the LED's, when is should be completely inactive. This pins are constantly giving current.

Could this be a fault with the board?

CrossRoads

Doubtful.  How is the LED wired up? Pin to anode, cathode to resistor, resistor to Gnd?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

zapdez

The jumper goes from pin 2, to cathode in LED, from cathode of LED to appropriate resistor, resistor to ground.

The LED is definately glowing the the pin is set to LOW, should this not be the case for the pin 2?

I definately think there is something amiss with that pin to be honest.

CrossRoads

Where is the LED anode connected? You used cathode twice.
If connected to pin 2, then yes, one would expect it to be off.
What is the resistor value?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

zapdez

#4
Jul 02, 2014, 10:24 pm Last Edit: Jul 02, 2014, 10:26 pm by zapdez Reason: 1
Sorry.

Pin 2 > LED Anode(+ Long leg) > LED Cathode(neg Shrt Leg) > 220ohm resistor > GRND

I have prgrammed pin 2 to:
OUTPUT and LOW.

But for some reson, the led still has a feignt glow.

I can swith it to HIGH, and the LED is much brighter, but for sure, when LOW, the LED is definately still glowing...


CrossRoads

You have the terms Anode and Cathode swapped.
Anode has long leg, cathode has short leg and the flat spot on the LED body.
I can't explain the glow.
Does it do that on other output pins as well? Or just D2?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

zapdez

It does that for pins 0, 1 and 2. All the other pins are working as expected.
Also, when using these pins, I'm getting no serial print messages at all.

But when using all other pins, everything is working well, plus, any serial messages work fine.

(Yes, just realised the previous confusion - thanks!)

BulldogLowell


It does that for pins 0, 1 and 2. All the other pins are working as expected.
Also, when using these pins, I'm getting no serial print messages at all.

But when using all other pins, everything is working well, plus, any serial messages work fine.

(Yes, just realised the previous confusion - thanks!)


"Used for communication between the Arduino board and a computer or other devices. All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output."




daveclark5

If your sketch has something like this in it:
 Serial.begin(9600);

It will use the serial comm.  On an Uno that's 0 and 1.
On Mega - you can change that I believe.

Try commenting them out
 // Serial.begin(9600);
    //Serial.println(" done");
   // Serial.println("SENSORS ACTIVE");

DrAzzy

0 will be pulled up no matter what, since that's connected, through a resistor, to the tx line of the serial adapter. Idle serial line is high, so pin 0 will be high unless driven otherwise. But driving the pin low should definitely stop the glow.

Do you have a multimeter? Measure voltage on the pin from ground, then disconnect the LED and measure again.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up