mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Melody class for playing simple tunes using tone()
This commit is contained in:
19
libraries/Melody/examples/PlayTone/PlayTone.pde
Normal file
19
libraries/Melody/examples/PlayTone/PlayTone.pde
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <Melody.h>
|
||||
|
||||
int notes[] = {
|
||||
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3,
|
||||
NOTE_REST, NOTE_B3, NOTE_C4, NOTE_REST
|
||||
};
|
||||
byte lengths[] = {4, 8, 8, 4, 4, 4, 4, 4, 2};
|
||||
|
||||
Melody melody(8);
|
||||
|
||||
void setup() {
|
||||
melody.setMelody(notes, lengths, sizeof(lengths));
|
||||
melody.setLoopCount(3);
|
||||
melody.play();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
melody.run();
|
||||
}
|
||||
Reference in New Issue
Block a user