Hi does anybody know what the best way to connect a switch is in pduino. it is a digital input.
How do you set up in the patch and how do you connect the switch physically to the arduino board?
Any help would be great!!
connecting switch in pduino
Hi does anybody know what the best way to connect a switch is in pduino. it is a digital input.
How do you set up in the patch and how do you connect the switch physically to the arduino board?
Any help would be great!!
Check the arduino-test.pd patch that comes with Pduino. There you can set a digital pin as input or output, it should be fairly easy to understand how. As for the circuit, as whale-av mentioned, you can follow the tutorial link.
Hi guys, thanks for the help so far.
I have a 2 pole switch and have connected the middle pin to pin6 in the arduino and set pduino so that pin6 is an input. one of the other legs is connected to 3.3V and then I've got another connected to ground. NO JOY.
Can you offer any advice?
Thanks!
What's a 2-pole switch? Is it an on-on switch? If so, your circuit is not correct. For on-on switches, the middle leg goes to ground, and the two side legs go to two digital pins, and also to 5V with a 10K resistor (a pull-up resistor), or the middle leg goes to 5V and the two other legs to two digital pins and to ground with a 10K resistor (a pull-down resistor).
Try this and set the two digital pins as input. If you use pull-up resistors, you'll get a 1 when the switch is off and a 0 when it's on. If you use pull-down resistors, the readings will be inverted.
Pull-up resistors seems counter-intuitive, as you get a 0 when turning the switch on, but they are said to be a more stable circuit.
Did you look for a circuit for the switch you are using? Can you give some more details about it?
Hello... I think that he has a 2-pole or a 1 pole changover switch, and as he is not really much into electronics he probably doesn't have any resistors. He should probably stop before some damage is done! The tutorial looked simple to me, but probably not to everybody, and the idea of pull-up resistors, as you say, is not universally understood.
Sorry if it sounds like I am dissing you Ric... it's not intentional.
@RicWainwright1 ... could you upload a photo of your switch?
Does the board that you have look identical to the one in the tutorial?
Hi it is ok, i am i don't know what I am doing wrong. I had set it up as alexanders had described and i still cant get it to work.
http://www.rapidonline.com/electronic-components/ultraminiature-toggle-switches-519971 this is similar to the switch I have!
Ahh in pd do you set the switch using send and receive similar to a resistor or is there a different way to set it up? that could be my problem!
It looks as though you have a 1-pole changover switch (3 connections?) in which case the centre connection switches between the two outer connections, and if it can also stop in the middle then in that position it is connected to neither.
It would be best if you could get hold of a resistor before you continue, because the pins need hardly any current to switch, and it would be best not to risk frying your processor. But with your switch you don't absolutely need one. So... middle contact of your switch to pin 2 (but you have chosen pin 6...., one of the outer contacts to ground and the other to +3.3V. You should be good.
I have to hand you back to Alexandros, as I don't have an Arduino.
David.
Hi, I have set up the switch how you've describe and still no joy!! this is very annoying but thanks for the help so far.
I have lots of resistors to use, i have set this switch up manually on many occasions i am just having issues connecting to with PD
I still believe that the middle leg of the switch should go to ground.
Try to make this circuit
This one uses digital pins 2 and 3. The resistors are 10kOhm, you can get them from your local electronics store.
so you have two inputs digital pins, 2 and 3, which will alternate between 0 and 1, as you change the position of the switch.
I might be wrong about the switch though...
Do you have an Arduino UNO?
I have arduino uno v3 i am using simple analogfirmata
@alexandros i have tried that circuit now and it doesn't work, David showed me an issue some other people were having where they had to change parts in pduino however i cant find the switching inputs patch
@RicWainwright1 I've written a tutorial on Arduino and Pd, without using the Firmata firmware and Pduino. It's a 40 page/10 projects tutorial, but I think it's worth it, as it will be easier if you know how to program the Arduino and use [comport] straight away, instead of the [arduino] abstraction (which is based on [comport]).
You can get it here http://forum.pdpatchrepo.info/topic/8560/arduino-for-pd-ers/4
Oops! Looks like something went wrong!