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.
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
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.
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. 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.
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.
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:
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.
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
arg! thats what I said, use the internal pullup
thats it, no candy for you!
(kidding, you can have some candy)
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.
it does now, think they introduced that with 1.0 while breaking compatibility with 5+ years of libraries (give n take right?)
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.
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..
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?
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
What is that white board?
Is that an IOIO?
@funkyguy4000 The white board is an Arduino Mini Pro Artic Edition running at 16Mhz 5V.
@xl97 small world indeed.
Artic edition?! Thats sweet!
Where did you get that? I literally spend all day looking at components and such and I've never seen that before.