Go Down

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

remedemic

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

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

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.
"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?"

remedemic

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

retrolefty


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

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 am Last 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.
"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?"

retrolefty


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

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

Go Up