Is it possible to run multiple buzzers and servos together at once?

Hello everyone, I have been trying to make something similar to this [OMFG] - Hello, 450kV Tesla Coil & Robot Orchestra cover [1,000 sub special] - YouTube but not as complex but I can't even come close. No matter what I try, I always get some sort of error message or the circuit just doesn't work. Would it be possible to run many different servos and buzzers together? I am just getting started with this Arduino so it may be a stupid question, but if you know please help. Thanks :slight_smile:

Please post YOUR code and the complete error messages. There should be no problem running multiple servos and buzzers, within limits of the servo library and available pins.

Would it be possible to run many different servos and buzzers together?

Yes, within some limits

What have you already tried ?

This is my code for attempting to run two buzzers at once:

#include <Tone.h>

int notes = 20;

int melody1 = {
NOTE_A5, NOTE_A5, NOTE_B5, NOTE_C6, NOTE_E6,
NOTE_F6, NOTE_F6, NOTE_F6, NOTE_E6, NOTE_D6, NOTE_E6,
NOTE_C6, NOTE_C6, NOTE_D6, NOTE_E6,
NOTE_G6, NOTE_G6, NOTE_E6, NOTE_G6, NOTE_E6

};
int mel1Durations = {
800, 200, 200, 200, 200,
400, 400, 200, 200, 200, 200,
800, 200, 200, 400,
400, 200, 200, 400, 400

};

int harmony1 = {

NOTE_E5,NOTE_E5,NOTE_E5,NOTE_E5,
NOTE_F5,NOTE_F5,NOTE_F5,NOTE_F5,
NOTE_E5,NOTE_E5,NOTE_E5,NOTE_E5,
NOTE_D5,NOTE_D5,NOTE_D5,NOTE_D5

};

int harm1Durations = {
400, 400, 400, 400,
400, 400, 400, 400,
400, 400, 400, 400,
400, 400, 400, 400

};

void setup() {
// put your setup code here, to run once:
digitalWrite(8, OUTPUT);
digitalWrite(9, OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < notes; i++){
tone(8, melody1_, mel1Durations*);_
tone(9, harmony1_, harm1Durations);
}
}
I get these error messages:
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer0_pin_port’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer0_pin_mask’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer1_pin_port’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer1_pin_mask’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer2_pin_port’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer2_pin_mask’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer0_toggle_count’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer1_toggle_count’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of timer2_toggle_count’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
Tone.cpp.o (symbol from plugin): In function timer0_pin_port':*</em></em></em> <em><em><em>*(.text+0x0): multiple definition of __vector_7’
libraries/ToneLibrary/Tone.cpp.o (symbol from plugin):(.text+0x0): first defined here
/Users/JarettLeVanRules/Downloads/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp: In function ‘main’:
/Users/JarettLeVanRules/Desktop/Random/Random.ino:58:40: warning: iteration 16 invokes undefined behavior [-Waggressive-loop-optimizations]
tone(9, harmony1, harm1Durations);
^
/Users/JarettLeVanRules/Desktop/Random/Random.ino:56:1: note: containing loop*

for (int i = 0; i < notes; i++){
^
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno._

Only one tone can be generated at a time. If a tone is already playing on a different pin, the call to tone() will have no effect. If the tone is playing on the same pin, the call will set its frequency.

tone library

UKHeliBob:
...within some limits