Electronic door bell with your favourite songs
Hi,I recently designed a sort of "library" in order to make easier to play exact notes on arduino with the buzzer. I included the frequencies of the notes (pleasant to be heard) with #defines . I then defined the value of the BPM ( you can modify it obviously) and according to that I defined the note values ( the most commonly used ones). With this defines you can easyly play a note with the command "tone" like this: tone(pin, note, duration) Code : /* Play Melody * ----------- * * Program to play melodies stored in an array, it requires to know * about timing issues and about how to play tones. * * The calculation of the tones is made following the mathematical * operation: * * timeHigh = 1/(2 * toneFrequency) = period / 2 * * where the different tones are described as in the table: * * note frequency period PW (timeHigh) * c 261 Hz 3830 1915 * d 29