Pages: [1] 2   Go Down
Author Topic: Documentation confusion:  (Read 2466 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8602
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2592
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Central MN, USA
Online Online
Tesla Member
***
Karma: 75
Posts: 7268
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27372
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

Turning 1 output high and 1 output low, repeated quickly 64 times, is the basis for a multiplexed display.


* 8x8multiplex.jpg (121.04 KB, 960x720 - viewed 31 times.)
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.

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks / OpenLCB rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Yes, with a bipolar LED:
0) pin1 LOW, pin2 LOW  LED off
1) pin1 HIGH, pin2 LOW  LED one colour
2) pin1 LOW, pin2 HIGH  LED other colour
3) pin1 HIGH, pin2 HIGH  LED off

Note, if you have a RED/GREEN LED, then alternate state s1 and 2 about gives YELLOW (or some approximation), changing the duty cycle lets you 'tune' the colour. 

David
Logged

Dr. David Harris
OpenLCB Dev Team

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or a low current 5vdc single coil latching relay (mine draw about 13ma) wired directly between two output pins as I have done in a few projects.


0) pin1 LOW, pin2 LOW  No current flowing in relay coil, it retains last commanded state
1) pin1 HIGH, pin2 LOW  relay placed in 'set' state
2) pin1 LOW, pin2 HIGH  relay placed in 'reset' state
3) pin1 HIGH, pin2 HIGH No current flowing in relay coil, it retains last commanded state

Lefty
« Last Edit: December 28, 2012, 08:02:38 pm by retrolefty » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8602
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so apart from Charlieplexing, bi-colour LEDs, latching relays, light bulbs, small peltier junctions, a low-power H-bridge, 1-wire serial comms and loopback testing I can't think of any way that is useful offhand.

______
Rob
« Last Edit: December 28, 2012, 08:49:25 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27372
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

smiley-cool
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.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so apart from Charlieplexing, bi-colour LEDs, latching relays, light bulbs, small peltier junctions, a low-power H-bridge, 1-wire serial comms and loopback testing I can't think of any way that is useful offhand.

______
Rob

I agree, except for the loopback testing thingee? Wouldn't any kind of logical 'loop back test' require a output pin wired to a input pin so continuity could be tested? Two outputs don't make any kind of loop back test in my book?

Lefty
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8602
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Two outputs don't make any kind of loop back test in my book?
Not really, one really has to be an input eh smiley

EDIT: Thinks, doesn't that apply to most of the other examples as well? No it doesn't. Where's my coffee.

______
Rob
« Last Edit: December 28, 2012, 08:56:46 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Two outputs don't make any kind of loop back test in my book?
Not really, one really has to be an input eh smiley

EDIT: Thinks, doesn't that apply to most of the other examples as well? No it doesn't. Where's my coffee.

______
Rob

Well who's idea was the loop back thingee anyway?  smiley-grin
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8602
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
who's idea was the loop back thingee anyway?
No idea, don't look at me. Loopback test? never heard of anything so stupid. How about those Jets eh? Don't mind me, I'm just passing through.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-grin
Logged

Pages: [1] 2   Go Up
Jump to: