Pages: [1]   Go Down
Author Topic: Confused about input vs output pins  (Read 442 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.instructables.com/files/deriv/FD4/4NFJ/GWTSNUSV/FD44NFJGWTSNUSV.LARGE.jpg

Pins 3,5, and 6 are considered OUTPUT pins but in this circuit they are taking in voltage? What I initially thought was that we would connect the 3 LED leads to the pins (like above), and connect the anode to the ground. Can the pins not create a voltage and output current?

Could someone please explain to me where I'm going wrong? Thank you in advance.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In this context a pin configured to be an output will be driven to the voltage level set by the sketch. That could mean that it sources current (when it's set high and the pin is connected via a load to ground) or sinks current (when it's driven low and connected via a load to a higher voltage).

If it's configured to be an input then it doesn't drive the pin voltage level but just enables the sketch to read what voltage the pin has been pulled to by whatever is connected to it.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2571
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The pic shows the anode ("common anode") at +5
The pins, that way, outputs nonetheless, are providing a path to Ground.

Output pins don't source voltage and open circuit, they present, alternately, +5 and Ground.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how are the pins controlling the level of the LEDs if they are simply directing the current to ground?
Logged

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

how are the pins controlling the level of the LEDs if they are simply directing the current to ground?

The series resistors are what are 'controlling' the amount of current for each led, the digital output pin set to LOW just allows the path for current flow. When set to HIGH the led/resistors have the same voltage on both ends so no current can flow.

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Im sorry I was referring to the PWM that is controlling the level of the LEDs. If the pins are acting as a path to ground, how is the PWM controlling the level of the LEDs?

And also, why are we using pins to send the current to ground? Why not just send connect the the LED to the ground after feeding in voltage through the 3 seperate LEDs? Is it because this is a common anode RGB LED? If it were a common cathod RGB LED, could I do it the way I described?

Thank you again, I appreciate it. I apologize, I'm a bit confused at the moment.
Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2571
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, right, it's the opposite of the anticipated schema (as ON = HIGH, OFF = LOW)

> > > In the case of your example, ON =LOW and OFF = HIGH.

> > > Just get some ordinary LEDs and try it out the one way and then the other.  You'll see.
« Last Edit: April 10, 2013, 08:39:59 pm by Runaway Pancake » Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

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

Im sorry I was referring to the PWM that is controlling the level of the LEDs. If the pins are acting as a path to ground, how is the PWM controlling the level of the LEDs?

The pwm output lets one change the duty cycle of the HIGH and LOW output switching such that the led will appear to have less 'effective' current as the duty cycle is reduced from 100% towards 0%. It's really your eye that is 'averaging' the light level, the instantaneous current is still either 0 ma or the current set by the resistor depending on the output state of the pwm pin at any instant of time.

And also, why are we using pins to send the current to ground? Why not just send connect the the LED to the ground after feeding in voltage through the 3 seperate LEDs? Is it because this is a common anode RGB LED? If it were a common cathod RGB LED, could I do it the way I described?

Yes, common anode or common cathode package configuration dictates what level has to be used for the common side of the leds.

Thank you again, I appreciate it. I apologize, I'm a bit confused at the moment.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks once again gentlemen. It's clear to me now.
Logged

Pages: [1]   Go Up
Jump to: