Go Down

Topic: Newbie question about Vcc (Read 1 time) previous topic - next topic

the-rebel-agent

Actually working on this:

http://www.youtube.com/watch?v=AYNur8XLJqQ

and migrated the sketch to a Mini Pro this night. Wanted to know IF It is a good practice to use an available pin to feed signal for a pull up switch. Do you know what I mean? For example, I have pin 8 and 9 free, and would like to use one of them to supply trigger switch.

Osgeld

the avr supports internal pullups so you dont have to use extra pins

set your pinMode to input, and then digital write high to the same pin in the setup function, you now have a input pin that is pulled high by the chip

the-rebel-agent

I think I did not explained my self. Just take a look at this circuit:



I was talking about using a pin 7 in high state to feed the switch instead of connect the 5v.

funkyguy4000

I think I get what you are saying.

Instead of having a button be the switch, you would set one pin to an input, and one pin to and output and then just connect them.  You would control the "switch" but using a digitalWrite High or Low command for the output pin and then just use digitalRead elsewhere in your code to detect whether its on or not.

Right?

Accelerate to 88 miles per hour.

the-rebel-agent

Right. My problem is that I will be using an unregulated power supply to feed the arduino mini pro, so I don't have a 5v power source to feed the switch. So I was thinking in re-use an available pin to do that work.

Go Up