Go Down

Topic: Documentation confusion: (Read 2 times) previous topic - next topic

cfishy

Hi, I'm just starting out, and the I'm getting confused about the definition of constant HIGH on the arduino programming language reference, in the constant section, it states:

http://arduino.cc/en/Reference/Constants
"When a pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at 5 volts. In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW."

I don't understand the last sentence: does it say that you can configure two pins as digital output and set one to HIGH and another to LOW, and connect the two directly? Why is that useful?

billroy

One rarely connects two pins directly together; in fact, it can cause over-current problems if you short a HIGH pin to a LOW pin without any resistance in the circuit.

The sentence is just trying to say that a pin set to HIGH can source current and a pin set to LOW can sink it.  Keep it under 20 ma per pin either way and you're good.

-br

Graynomad

Yes it does mean that, and no I can't think of any way that is useful offhand. Maybe to loopback test software serial or something.

_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Riva


Yes it does mean that, and no I can't think of any way that is useful offhand. Maybe to loopback test software serial or something.

A 2 pin bi-colour LED maybe.

liudr

Just think of the pin set to HIGH as + end of battery and pin set to LOW as - end of battery. You don't want to touch these ends together!! But you can put a small light bulb between the two to light it up. As Riva said, there are LEDs that turn on one color if supplied + and - on pins 1 and 2, then turns on another color when supplied - and + on pins 1 and 2. I think Charlieplexing also uses this trick to control lots of LEDs with very few pins.

Go Up