73
edits
Paulmaidment (talk | contribs) |
Paulmaidment (talk | contribs) |
||
Line 2: | Line 2: | ||
The circuit is simple, an 8 ohm speaker is connected to Arduino pin 8, with the cathode connected to the ground. | The circuit is simple, an 8 ohm speaker is connected to Arduino pin 8, with the cathode connected to the ground. | ||
/* Modified Tone Sketch from Tom Igoe - Taken from the Arduino SDK examples */ | |||
/* Modded by NJA Hackers to play Jingle Bells*/ | |||
#include "pitches.h" | |||
// notes in the melody: | // notes in the melody: | ||
Line 41: | Line 26: | ||
}; | }; | ||
void setup() { | void setup() { | ||
int numberOfNotes = sizeof(melody)/sizeof(int); | int numberOfNotes = sizeof(melody)/sizeof(int); | ||
// iterate over the notes of the melody: | // iterate over the notes of the melody: | ||
for (int thisNote = 0; thisNote < numberOfNotes; thisNote++) { | for (int thisNote = 0; thisNote < numberOfNotes; thisNote++) { |
edits