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
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

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.

funkyguy4000

Oh, is this whole thing operating at 3.3V?  If you have enough power to send a HIGH signal to the microcontroller, then you can still use the button by feeding it 3.3V. 

What the button does is just make a circuit.  When its pressed, it completes the circuit.  Since the output is connected to the arduino, and if the whole thing is running at 3.3V and is using 3.3V logic, then getting a t 3.3V from the button will still send the HIGH signal. 

What voltage are you going to be using?  Is this a 3.3v pro mini or a 5v pro mini.
Accelerate to 88 miles per hour.

pgmartin

No need to use another pin to "feed signal".

You can activate the internal pull up, so you can forget about that extra resistor you are using.
You can achieve this by using:

Code: [Select]

pinMode(2, INPUT);
digitalWrite(2, HIGH);


More about it here: http://www.arduino.cc/en/Tutorial/DigitalPins

by using the internal pullup, you just use the switch to give a temporary connection to ground.

the-rebel-agent

#7
Aug 15, 2012, 07:56 pm Last Edit: Aug 15, 2012, 08:15 pm by the-rebel-agent Reason: 1
Wow! Thanks, good to know about that. Gracias Martin, yo tambien soy de Argentina.

PD: Encontre este ejemplo despues de investigar: http://www.arduino.cc/en/Tutorial/InputPullupSerial

Osgeld

arg! thats what I said, use the internal pullup

thats it, no candy for you!

(kidding, you can have some candy)
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

the-rebel-agent

Sorry I did not get it from the very fist time. Reading that tutorial found out about the INPUTPULLUP mode, that saves you 1 line of code BTW.

Osgeld

it does now, think they introduced that with 1.0 while breaking compatibility with 5+ years of libraries (give n take right?)
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

the-rebel-agent

Added for 1.0.1. Just tested and worked out like a charm. Right now testing an Ethernet shield r3. Connected it to the laser gun project and every time the server detects an incoming connection fires the laser gun. Very funny.

xl97

#12
Aug 16, 2012, 05:14 pm Last Edit: Aug 16, 2012, 05:34 pm by xl97 Reason: 1
very cool!..

I too am working on code for a blaster   (blasterOSv1.0)

similar to yours..

I have it doing a:

'power on/boot sound'
slider switch for manual fire or auto fire
RGB led so I can pick my color for fire type(s)..

my last step was to add a motor.. so I could spin the barrel like a gatling gun.. but I havent been able to find a small motor with enough torque and speed to work..

http://www.youtube.com/v/4RuLUTsuSpg?version=3&hl=en_US&rel=0

the-rebel-agent

Very cool blaster idea. Love the automatic firing option. Not applicable to V Visitor laser gun, but could be implemented for other ones. Will add that feature to my software. Implemented the INPUT_PULLUP pin method and combined it with the Ethernet shield.





Now I am activating the trigger over the Internet from my work and the laser gun is resting at my dinner table at home. Cool right?

xl97

VERY cool!

I have YET to play with any Ethernet stuff  or my RFID stuff yet!!


just worked on the Arduino/Waveshield merge.. and some initial code for now..

love your project thought.. I always read your posts now that I know you belong to www.therpf.com .. lol

Go Up