changeset 2:52938b0e680e

Put the notes in PROGMEM
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Mon, 09 Nov 2015 23:11:15 +0100
parents 7561480c9183
children a75ba443ecfa be9d7693aaf6
files alternate/alternate.ino
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/alternate/alternate.ino	Sun Oct 25 14:17:30 2015 +0000
+++ b/alternate/alternate.ino	Mon Nov 09 23:11:15 2015 +0100
@@ -7,12 +7,12 @@
     NOTE_FS5, NOTE_GS4, NOTE_GS5,
 };
 
-const signed char INTRO_NOTES[] = {
+const signed char INTRO_NOTES[] PROGMEM = {
 9, 12, -15, -4, 9, 12, 15, 4, 6, 10, 6, 2, -4, -15, 9, 12, -15, -4, 6, 2,
 4, 6, 13, 10, 13, 4, 0
 };
 
-const signed char MELODY_NOTES[] = {
+const signed char MELODY_NOTES[] PROGMEM = {
 -15, -17, 9, 9, 0, 3, 7, 5, 3, 0, -3, -5, -7, 7, 5, 3, 5, 9, 15, 17, 9, 15, 5,
 9, 3, 5, 3, -9, -15, 17, 9, 15, 5, 9, 3, 7, 9, 7, 5, 3, 5, -7, 3, 5, 9, 15, 5,
 9, 5, 3, -5, -3, -5, -15, -17, 9, 9, 0, 3, 7, 5, 3, 0, -3, -5, -7, 7, 5, 3, 5,
@@ -40,7 +40,7 @@
 
 void play(const signed char *notes, const unsigned int length) {
     for (unsigned int n = 0; n < length; n++) {
-        int f = notes[n];
+        signed char f = pgm_read_byte_near(notes + n);
         int d;
         if (f < 0) {
             d = SPEED / 8;