EDIT:
After more trouble shooting, apparently my M-F wires don't fit well in the pins. If I jiggle them and hold them carefully, the program preforms. Thank you.
I'm brand new to this and I'm using an Elegoo tutorial to make a passive buzzer play a song. Following the tutorial I was told to make sure the pitches.h library was installed. It wasn't and wasn't in the drop down menu, so I went out to the Aurdrino website and found the zip file, downloaded it and installed it. So now my code compiles and uploads with no problems. The pitches library shows "installed." However, the buzzer doesn't make any noise. I've triple checked my wiring (it's only two wires after all, I even got them out of the picture by plugging the buzzer directly into the board and changing pins) and I have checked the +/- on the buzzer....no noises.
Can anyone point me in the right direction? It's got me befuddled.
I've put the code down below (which was included on the CD, so I would think it should work).
Thank you,
Russ
#include "pitches.h"
// notes in the melody:
int melody[] = {
NOTE_C5, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_B5, NOTE_C6};
int duration = 500; // 500 miliseconds
void setup() {
}
void loop() {
for (int thisNote = 0; thisNote < 8; thisNote++) {
// pin8 output the voice, every scale is 0.5 sencond
tone(8, melody[thisNote], duration);
// Output the voice after several minutes
delay(1000);
}
// restart after two seconds
delay(2000);
}