Go Down

Topic: 5 buttons on one pin. (Read 758 times) previous topic - next topic

retrolefty

#5
Nov 29, 2012, 12:33 am Last Edit: Nov 29, 2012, 12:59 am by retrolefty Reason: 1
Not sure that 'charging' circuit for the caps is going to work. It's acting like a 'high side switch' so must be a PNP transistor and as such I don't think the arduino output pin will be able to correctly turn on and off the transistor. But maybe I'm all wet and just miss seeing a real schematic drawing?  :D

Also I don't see a common ground connection from the 12 supply and the arduino, which I'm sure is a requirement.



Lefty

jezza103

Hi Lefty there is a common ground between the Arduino and the power supply, But I forgot to show that. I just showed a very basic circuit. I have had the circuit running on a  running on a breadboard with a 5v regulator limiting the voltage and a simple on off switch. You are right it is a PNP transistor Sorry my drawing  was a bit vague. The other transistor is an NPN.   The NPN transistor will conduct and pull its collector towards ground.   The base of the PNP transistor is pulled down, and the PNP transistor is switched on. I an sorry I was worried about the code not the drawing.
Jezza
There are times when electronics projects are like Women. Just when you think everything is fine the blow up in your face :-0

liudr

You are missing those wires that are important to show. Those are wires with resistors. Where are they?

jezza103


The resistors are connected to the buttons in a daisy chain see picture.
Can I ask if I can use 5 pins on the Arduino to go to the same transistor or would that cause problems. I have no trouble controlling 5 separate pins with the buttons like this but would like to know if they all connected to the same output and say 2 buttons were pressed at the same time.


  if (val >850 && val < 865 ) digitalWrite (Pin8,  HIGH); // turn on test led 1
  if (val >890 && val < 910 ) digitalWrite (Pin9,  HIGH); // turn on test led 2
  if (val >930 && val < 940 ) digitalWrite (Pin10, HIGH); // turn on test led 3
  if (val >970 && val < 980 ) digitalWrite (Pin11, HIGH); // turn on test led 4
  if (val >1015 && val < 1030)digitalWrite (Pin12, HIGH); // turn on test led 5
Jeremy

There are times when electronics projects are like Women. Just when you think everything is fine the blow up in your face :-0

jezza103

I have just had an Idea. Could I make it using one button with a time button is pressed for to set the value the capacitors are charged to? Also have an led blink while the butoon is pressed ie 1 secong 1 flash of led and charge to (x). two secconds two flashes of led and charge to (y). ETC
If this is possible how would i write the delay in button pressed time?
Thank you all for your input so far.
Jezza
There are times when electronics projects are like Women. Just when you think everything is fine the blow up in your face :-0

Go Up