Hey guys, first post here. I have two arduino unos that I want to connect in order to play a song. One arduino plays the bass notes while the other plays the melody. Any ideas on how I would go about it?
Sorry if this is on the wrong board, haven't done too much digging.
Make them do the -exact- same thing. Read some file of music (Your choice) and play the notes. Then, have one Arduino start, and when it does, have it toggle a wire to the other Arduino to tell it to start playing its file. (And that file has the "other" notes.)
Then when you want 3 Arduinos, just give the third its file of notes and hook it to the same "start" wire.
Hey guys, I'm completely new to the Arduino platform and I have an issue. I need two UNOs to execute their commands at the exact same time. How would I go about about doing this?
FiveTomb:
Hey guys, I'm completely new to the Arduino platform and I have an issue. I need two UNOs to execute their commands at the exact same time. How would I go about about doing this?
Thanks for the help!
Define "commands". Do you mean instruction or do you mean something telling the Arduinos to do something?
jurs:
What is the technical meaning of "exact same time"?
Do you mean "same second? Or same millisecond? Or same microsecond?
And what is "their commands", in case you describe that term a bit more datailed?
The commands that I'm giving them is to play a melody. More specifically, the song of storms. I have one arduino playing the higher melody notes, and the other is playing the bass notes. Each is connected to a piezo speaker. I need them to start playing their parts at the exact same time.
FiveTomb:
The commands that I'm giving them is to play a melody. More specifically, the song of storms. I have one arduino playing the higher melody notes, and the other is playing the bass notes. Each is connected to a piezo speaker. I need them to start playing their parts at the exact same time.
Starting at the exact time might be arranged by making them wait for a signal from the same push button. DPST switch, or similar. The two will certainly not stay together for very long unless both boards use the same clock signals.
Can these Arduinos be placed right next to each other?
If the two Arduinos are close together it should be possible to link two I/O pins so that one Arduino can send a "metronome" signal to the other (perhaps once per second) and the receiving Arduino can use that to correct any drift in the value of millis().
The OP doesn't want or need to run two Arduinos in syncronisim. That is just a simple minded and quite futile approach. All he needs to do is to trigger the second Arduino to make the sound at the right time. He could use MIDI protocol or in fact anything else to signal to the second superfluous Arduino to make a sound. Any delay will be totally inaudible.
Paul_KD7HB:
Starting at the exact time might be arranged by making them wait for a signal from the same push button. DPST switch, or similar. The two will certainly not stay together for very long unless both boards use the same clock signals.
Can these Arduinos be placed right next to each other?
Grumpy_Mike:
Is this a professor of electronics or music?
He sounds like it is music and has no idea about electronics.
It's an engineering orientation class. We are collaborating with another group, hence the two arduinos playing different parts of a song. Don't know why he just won't let us use 2 piezos though.
FiveTomb:
It's an engineering orientation class. We are collaborating with another group, hence the two arduinos playing different parts of a song. Don't know why he just won't let us use 2 piezos though.
Piezos? I don't think it's a good idea to use piezos for playing music (could be wrong, but I doubt it's even feasible). You should be using electromagnetic speakers instead.
BTW, using an opamp in summing configuration, you can add the signals from both arduinos and play BOTH signals using one speaker!