Go Down

### Topic: Confused about input vs output pins (Read 638 times)previous topic - next topic

#### remedemic

##### Apr 11, 2013, 02:47 am
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.

#### PeterH

#1
##### Apr 11, 2013, 02:57 am
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.
I only provide help via the forum - please do not contact me for private consultancy.

#### Runaway Pancake

#2
##### Apr 11, 2013, 02:59 am
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.
"You gotta fight - for your right - to party!"
"Who is like unto the beast? who is able to make war with him?"
It's "bipolar transistor" or "junction transistor" - "BJT" is stupid.
When all else fails, check your wiring!

#### remedemic

#3
##### Apr 11, 2013, 03:12 am
how are the pins controlling the level of the LEDs if they are simply directing the current to ground?

#### retrolefty

#4
##### Apr 11, 2013, 03:16 am

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

#### remedemic

#5
##### Apr 11, 2013, 03:28 am
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.

#### Runaway Pancake

#6
##### Apr 11, 2013, 03:35 amLast Edit: Apr 11, 2013, 03:39 am by Runaway Pancake Reason: 1
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.
"You gotta fight - for your right - to party!"
"Who is like unto the beast? who is able to make war with him?"
It's "bipolar transistor" or "junction transistor" - "BJT" is stupid.
When all else fails, check your wiring!

#### retrolefty

#7
##### Apr 11, 2013, 03:39 am

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.

#### remedemic

#8
##### Apr 11, 2013, 03:50 am
Thanks once again gentlemen. It's clear to me now.

Go Up

Please enter a valid email to subscribe