Pages: [1] 2   Go Down
Author Topic: Newbie question about Vcc  (Read 814 times)
0 Members and 1 Guest are viewing this topic.
Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually working on this:



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.
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1000
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Accelerate to 88 miles per hour.

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1000
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Accelerate to 88 miles per hour.

Chile
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 15, 2012, 01:15:57 pm by the-rebel-agent » Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

arg! thats what I said, use the internal pullup

thats it, no candy for you!

(kidding, you can have some candy)
Logged


Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it does now, think they introduced that with 1.0 while breaking compatibility with 5+ years of libraries (give n take right?)
Logged


Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 16, 2012, 10:34:58 am by xl97 » Logged


Argentina
Offline Offline
Full Member
***
Karma: 5
Posts: 160
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: [1] 2   Go Up
Jump to: