Hello,
Is it possible to have two output pins to be connected to each other like a switch. For example: pin a and pin b are connected when something in the script happens.
Hello,
Is it possible to have two output pins to be connected to each other like a switch. For example: pin a and pin b are connected when something in the script happens.
Why? you creating some kinda detonator?
Haha... no i dont think so... Maybe:)
I want to have some switch turned on and off controlled by a script,
but i have just bought an arduino and really no experience.
Hello,
Wessie3000:
Is it possible to have two output pins to be connected to each other like a switch.
Often called dry contacts.
No. Arduinio pins are not capable of acting as dry contacts.
Wessie3000:
I want to have some switch turned on and off controlled by a script,
Without a description of "some switch" the answer is maybe.
switch is an extremely vague term. There are many kinds of switches.
If you told us WHAT you wanted to switch , that would narrow down the possibilities to those that would apply to that application. Are you trying to switch the output of a 10,000 W generator or the output of a 5W solar panel ? Everything revolves around the answer. Instead of being so vague, why don't start your post by saying "I want to switch a [blank blank]. How can I do this with an arduino ?"
Doesn't that make more sense ?
Reference to your prior questions suggests you wish to switch audio.
The device to do that is a 74HC4066.
Reference to your prior questions suggests you wish to switch audio.
What prior questions ? Where ?
Ok ok:) Here are the details. I have a guitar multi effect. The zoom g3 and there is a tap tempo switch on that thing. The switch I was talking about. I made an hole in the effect and soldered two wires at the back of the switch of the G3. And made a footswitch and now I can control the tap tempo with my foot.
So far so good.....
But now I would like to have my arduino board soldered to the switch (with another two wires) in some way. So that a script could control my tap tempo.
I am making this Libre Arts - Home
to have a midi in on my arduino
and maybe this script at the bottom of the page
http://forum.arduino.cc/index.php?topic=20473.0
Hopefully this will blink a led in the same tempo of a midi clock on the arduino
But now I dont know how to connect some sort of output on the arduino to the switch.
Maybe an optocoupler, but there might be another way......
Hopefully this clears things up:)btw i am from the netherlands, so my "english" might be a bit weird. Sorry for that..
If it's a foit switch the signal on the switch contacts might not be an audio signal. Di you know anything about the tap switch circiitry ?
An optocoupler could work if there is a DC voltage on the open switch (measure it).
Or use a small relay, like a DIL reed relay.
An Arduino pin could operate a small relay directly if the coil resistance is >~200ohm.
Don't forget the kickback diode across the coil.
Er is ook een Nederlandse sectie op deze site.
Leo..
There is no audio on the switch. Its just a open/close switch
Something like this??
http://www.ecs.umass.edu/ece/m5/images/relay_circuit_schematic_L.jpg
And does that make a lot of noise?
Yes , that would work.
And does that make a lot of noise?
It makes a small click which is barely audible. If there was any sound coming from anything else you would not be able to hear the click, however, I don't know if the tap (foot) switch is a dry contact switch or a semiconductor (transistor) switch , hence the question about the switch circuitry. If it is a dry contact switch like a relay then your circuit would work fine. If it was a transistor switch then you would probably have to try to duplicate it using a transistor or mosfet. I don't know anything about that particular circuitry. If you can find find the schematic on the web that would help.
its a dry contact. So itll probably work then.
Thanks all!!
I am going to try it all out.....
One question. If i will buy something like this
Is that relais okay?
The point is, while a relay will certainly emulate a switch perfectly well, it is generally - in this century - not the best way to perform a function, but you need to know what part the switch plays in the circuit to suggest the best way. So we would need the circuit of the device in question.
Failing that, well, get a relay. Then you have to be concerned as to how to drive a relay with an Arduino - which is not as simple as it seems.
I have managed to put it all together and it works. The relais makes a bit of noise. So i might rap it in some sort of material.
Furthermore I was wondering if it is possible to change the script to let it do the following:
Can I let the script run for say 10 clicks and after the tenth the output of pin 6 stays open.
And when the script detect a change in input it sends 10 clicks again.
So I have an input of 120 bpm. Output sends 10 clicks and then stays "open". After a change in bpm it sends 10 clicks again etc.
This is the script:
int counter = 0;
int output_pin = 6; // set output pin
byte midi_start = 0xfa;
byte midi_stop = 0xfc;
byte midi_clock = 0xf8;
byte midi_continue = 0xfb;
int play_flag = 0;
byte data;
void setup() {
Serial.begin(31250);
pinMode(output_pin, OUTPUT);
}
void loop() {
if(Serial.available() > 0) {
data = Serial.read();
if(data == midi_start) {
play_flag = 1;
}
else if(data == midi_continue) {
play_flag = 1;
}
else if(data == midi_stop) {
play_flag = 0;
}
else if((data == midi_clock) && (play_flag == 1)) {
Sync();
}
}
}
void Sync() {
if(counter == 23) {
counter = 0;
digitalWrite(output_pin, HIGH);
delay(100);
}
else if(counter < 23) {
counter = counter + 1;
digitalWrite(output_pin, LOW);
}
else {
counter = counter + 1;
}
}
Go and read the instructions, then go back and modify your post (use the "More --> Modify" option to the bottom right of the post) to mark up the code as such so we can examine it conveniently and accurately.
If you do not do this, the code you post could easily be garbled and is certainly anything but easy to read.
Note: Also mark up any data in the same way. This includes error output that you get from the IDE.
And - before you post code, use "Auto Format" in the Tools menu to properly present the code.
Try and avoid unnecessary white space (blank lines). You should only use these to separate functional blocks of code.
For clarification of my project. This is what I did. a jpeg in an attachment.
24 midi signals coming in per quarter note from my laptop. I can change the bpm on my laptop.
Arduino board translates those midi clock signals into a pulse of 1 per quarter note. So when i have a bpm of 60. My relais makes contact every second for 100 ms. That goes into my zoom g3 multieffect via an off on switch.
So...
Is it possible to have my arduino script to detect a change in the bpm.
I would like if i have a certain bpm on my laptop, say 120, that arduino sends 10 clicks in 5 seconds. And when i change the bpm, say 60, it sends 10 clicks in 10 seconds.
After those 10 clicks the relais must stay on
And if anyone has an idea for another circuit instead of the relais. Id love to hear it!