#include // notes in the melody: int numberOfNotes = 1440; PROGMEM prog_uint16_t melody[] = { 988, 0, 0, 784, 659, 494, 392, 330, 165, 0, 330, 0, 165, 247, 330, 392, 165, 0, 0, 247, 330, 392, 165, 0, 494, 0, 392, 0, 247, 330, 392, 0, 247, 330, 392, 0, 147, 0, 294, 0, 220, 294, 370, 147, 0, 220, 294, 370, 147, 494, 147, 659, 147, 784, 0, 0, 988, 165, 0, 330, 0, 247, 330, 392, 165, 0, 247, 330, 392, 165, 0, 494, 0, 392, 0, 247, 330, 392, 0, 247, 330, 392, 0, 147, 0, 294, 0, 220, 294, 370, 147, 0, 220, 294, 370, 147, 0, 165, 0, 247, 330, 392, 0, 247, 330, 392, 0, 494, 659, 0, 392, 0, 247, 330, 392, 659, 0, 247, 330, 392, 784, 740, 0, 659, 220, 294, 370, 587, 220, 294, 370, 0, 0, 0, 659, 196, 262, 330, 131, 0, 196, 262, 330, 131, 98, 0, 196, 247, 294, 587, 196, 247, 294, 0, 392, 587, 523, 196, 247, 294, 494, 196, 247, 294, 587, 523, 0, 262, 0, 220, 262, 330, 523, 220, 262, 330, 0, 494, 0, 196, 247, 330, 82, 0, 0, 0, 247, 330, 82, 0, 494, 659, 82, 0, 784, 0, 0, 988, 82, 0, 330, 0, 659, 247, 330, 392, 659, 0, 247, 330, 392, 0, 494, 659, 247, 330, 392, 0, 247, 330, 392, 784, 740, 659, 220, 294, 370, 587, 220, 294, 370, 0, 131, 0, 659, 0, 196, 262, 330, 0, 131, 0, 196, 262, 330, 131, 0, 330, 0, 196, 262, 330, 0, 196, 262, 330, 740, 784, 0, 247, 0, 196, 247, 294, 784, 0, 784, 196, 247, 294, 0, 440, 880, 220, 880, 262, 0, 220, 262, 0, 740, 147, 220, 294, 370, 147, 0, 220, 294, 370, 0, 784, 740, 0, 659, 220, 294, 370, 587, 740, 220, 294, 370, 740, 784, 0, 784, 0, 98, 0, 784, 247, 294, 392, 784, 247, 294, 392, 0, 740, 123, 247, 311, 370, 123, 0, 247, 311, 370, 0, 659, 165, 247, 330, 392, 165, 0, 247, 330, 392, 784, 0, 784, 740, 659, 220, 294, 370, 587, 220, 294, 370, 740, 784, 0, 98, 247, 294, 392, 784, 247, 294, 392, 0, 0, 740, 123, 247, 311, 370, 0, 247, 311, 370, 0, 659, 165, 247, 330, 392, 0, 247, 330, 392, 784, 740, 0, 659, 220, 294, 370, 587, 220, 294, 370, 0, 659, 0, 131, 196, 262, 330, 659, 196, 262, 330, 0, 659, 196, 262, 330, 131, 0, 196, 262, 330, 0, 131, 0, 392, 0, 247, 0, 659, 196, 262, 330, 659, 0, 196, 262, 330, 0, 587, 523, 196, 247, 294, 494, 196, 247, 294, 587, 523, 110, 0, 220, 440, 262, 0, 523, 220, 523, 262, 110, 0, 494, 82, 247, 330, 392, 0, 247, 330, 392, 82, 0, 494, 0, 392, 0, 247, 330, 392, 0, 247, 330, 392, 0, 147, 0, 123, 220, 294, 370, 147, 0, 220, 294, 370, 0, 494, 0, 659, 0, 784, 0, 988, 0, 988, 0, 988, 165, 0, 330, 0, 247, 330, 392, 165, 0, 247, 330, 392, 165, 0, 392, 0, 247, 330, 392, 0, 247, 330, 392, 0, 494, 0, 294, 0, 220, 294, 370, 587, 0, 220, 294, 370, 0, 659, 1047, 0, 330, 131, 330, 392, 523, 784, 0, 784, 0, 330, 392, 523, 165, 0, 784, 0, 196, 0, 330, 392, 523, 0, 330, 392, 523, 0, 1047, 0, 988, 0, 988, 0, 988, 0, 988, 0, 880, 330, 392, 523, 880, 0, 330, 392, 523, 1047, 0, 0, 988, 0, 988, 0, 988, 0, 988, 0, 98, 784, 294, 392, 494, 784, 0, 294, 392, 494, 123, 0, 392, 0, 784, 147, 294, 392, 494, 0, 294, 392, 494, 0, 392, 0, 247, 0, 294, 392, 494, 0, 294, 392, 494, 784, 0, 784, 0, 440, 880, 0, 147, 0, 587, 294, 440, 523, 587, 0, 294, 440, 523, 185, 0, 587, 0, 220, 294, 440, 523, 0, 294, 440, 523, 0, 988, 0, 988, 0, 988, 0, 988, 0, 880, 294, 440, 523, 784, 0, 784, 294, 440, 523, 880, 0, 988, 0, 988, 0, 988, 0, 247, 165, 0, 330, 392, 494, 784, 0, 784, 0, 330, 392, 494, 123, 0, 784, 0, 784, 0, 247, 98, 0, 330, 392, 494, 659, 0, 330, 392, 494, 82, 0, 330, 659, 0, 330, 392, 494, 0, 330, 392, 494, 0, 370, 0, 247, 0, 330, 392, 494, 392, 0, 330, 392, 494, 0, 440, 0, 87, 0, 262, 349, 440, 0, 262, 349, 440, 110, 0, 1047, 0, 131, 0, 220, 262, 349, 0, 220, 262, 349, 175, 0, 349, 0, 523, 0, 262, 349, 440, 0, 262, 349, 440, 0, 1047, 0, 523, 0, 220, 262, 349, 0, 220, 262, 349, 0, 1319, 988, 392, 784, 392, 659, 392, 494, 0, 392, 0, 330, 165, 0, 392, 494, 659, 0, 392, 494, 659, 123, 0, 784, 0, 98, 0, 392, 494, 659, 0, 392, 494, 659, 82, 0, 740, 0, 392, 494, 659, 0, 392, 494, 659, 0, 740, 0, 784, 0, 392, 494, 659, 370, 0, 392, 494, 659, 0, 392, 0, 262, 0, 131, 0, 311, 392, 523, 0, 0, 311, 392, 523, 156, 0, 784, 0, 196, 0, 262, 311, 392, 0, 262, 311, 392, 262, 523, 0, 392, 0, 311, 392, 523, 0, 311, 392, 523, 0, 784, 0, 392, 0, 262, 311, 392, 0, 311, 392, 0, 1175, 587, 880, 587, 740, 587, 440, 587, 370, 0, 294, 370, 440, 587, 0, 370, 440, 587, 220, 0, 0, 185, 370, 440, 587, 0, 370, 440, 587, 147, 0, 659, 0, 370, 440, 587, 0, 370, 440, 587, 0, 659, 0, 740, 0, 370, 440, 587, 147, 0, 370, 440, 587, 165, 392, 165, 494, 165, 0, 659, 165, 0, 0, 784, 0, 988, 0, 988, 165, 659, 0, 247, 330, 392, 659, 0, 247, 330, 392, 784, 294, 0, 740, 0, 220, 0, 659, 220, 294, 370, 587, 220, 294, 370, 0, 330, 0, 659, 0, 196, 262, 330, 131, 0, 196, 262, 330, 131, 0, 98, 0, 0, 0, 247, 0, 587, 392, 587, 0, 247, 294, 392, 0, 392, 587, 0, 294, 523, 0, 247, 494, 392, 494, 247, 0, 587, 392, 587, 523, 0, 262, 0, 262, 440, 523, 262, 523, 440, 0, 392, 0, 494, 0, 247, 0, 392, 82, 0, 247, 392, 82, 494, 0, 0, 659, 0, 784, 82, 988, 82, 0, 247, 330, 392, 659, 0, 247, 330, 392, 0, 330, 0, 659, 0, 247, 330, 392, 0, 247, 330, 392, 0, 784, 0, 784, 740, 0, 440, 659, 0, 220, 294, 370, 587, 220, 294, 370, 0, 523, 0, 659, 0, 196, 262, 330, 131, 0, 196, 262, 330, 131, 0, 392, 0, 262, 523, 392, 0, 262, 0, 0, 392, 740, 494, 784, 0, 247, 494, 392, 784, 247, 392, 0, 880, 0, 262, 523, 440, 0, 262, 440, 0, 740, 0, 147, 0, 220, 294, 370, 0, 784, 220, 294, 370, 784, 0, 784, 0, 740, 0, 659, 0, 220, 294, 370, 587, 220, 294, 370, 740, 0, 784, 98, 0, 247, 294, 392, 784, 247, 294, 392, 0, 740, 123, 0, 247, 311, 370, 0, 247, 311, 370, 0, 659, 165, 0, 247, 330, 392, 0, 247, 330, 392, 784, 740, 0, 659, 0, 294, 370, 440, 587, 294, 370, 440, 740, 0, 784, 0, 784, 0, 98, 0, 294, 392, 494, 784, 294, 392, 494, 0, 740, 123, 0, 311, 370, 494, 0, 311, 370, 494, 0, 659, 165, 0, 330, 392, 494, 0, 330, 392, 494, 784, 740, 659, 0, 370, 440, 587, 370, 440, 587, 0, 659, 0, 131, 0, 330, 392, 523, 659, 330, 392, 523, 0, 659, 0, 131, 0, 330, 392, 523, 0, 330, 392, 523, 131, 0, 98, 0, 294, 0, 247, 392, 0, 587, 247, 0, 587, 392, 0, 440, 523, 0, 330, 494, 262, 440, 523, 0, 262, 0, 440, 0, 494, 165, 0, 82, 0, 247, 330, 392, 0, 247, 330, 392, 0, 82, 0, 370, 0, 165, 0, 82, 0, 247, 330, 392, 659, 0, 247, 330, 392, 0, 659, 0, 247, 330, 392, 0, 247, 330, 392, 784, 740, 0, 659, 220, 294, 370, 587, 220, 294, 370, 0, 659, 0, 131, 0, 262, 330, 392, 659, 262, 330, 392, 131, 0, 131, 0, 262, 330, 392, 0, 262, 330, 392, 0, 880, 0, 440, 784, 0, 784, 0, 740, 220, 294, 370, 740, 0, 220, 294, 370, 880, 784, 0, 659, 185, 220, 294, 0, 740, 185, 220, 294, 0, 196, 247, 392, 330, 494, 659, 0 }; PROGMEM prog_uint16_t noteDurations[] = { 9, 1, 1, 17, 17, 16, 13, 18, 24, 55, 15, 124, 12, 12, 15, 15, 12, 106, 6, 12, 12, 15, 85, 51, 16, 153, 15, 137, 12, 12, 18, 123, 12, 12, 18, 135, 14, 155, 14, 139, 14, 10, 19, 41, 81, 14, 10, 19, 27, 14, 14, 17, 14, 15, 7, 15, 17, 134, 22, 15, 137, 12, 12, 18, 30, 92, 12, 9, 18, 122, 17, 16, 153, 15, 137, 12, 12, 18, 123, 12, 12, 18, 135, 14, 155, 14, 139, 14, 10, 19, 41, 81, 14, 10, 19, 116, 19, 249, 68, 12, 12, 18, 123, 12, 12, 18, 135, 8, 135, 21, 15, 137, 12, 12, 18, 109, 13, 12, 12, 20, 141, 177, 4, 126, 14, 14, 16, 123, 14, 10, 16, 137, 8, 5, 305, 10, 15, 15, 84, 39, 10, 15, 18, 145, 286, 20, 10, 16, 17, 121, 15, 12, 14, 137, 8, 145, 164, 15, 16, 14, 119, 15, 16, 17, 129, 164, 9, 15, 137, 14, 11, 18, 122, 14, 11, 15, 119, 249, 89, 10, 16, 15, 36, 82, 10, 5, 16, 15, 24, 8, 6, 17, 36, 6, 11, 12, 7, 10, 24, 137, 15, 128, 9, 12, 12, 18, 74, 48, 12, 12, 18, 135, 8, 308, 12, 12, 18, 123, 12, 9, 18, 143, 169, 144, 14, 10, 19, 121, 14, 14, 13, 137, 15, 5, 287, 10, 10, 15, 15, 10, 92, 18, 10, 15, 18, 176, 127, 15, 137, 10, 15, 15, 124, 10, 15, 18, 116, 164, 22, 16, 136, 10, 12, 17, 28, 1, 96, 15, 12, 14, 137, 5, 312, 18, 7, 15, 124, 18, 23, 166, 173, 123, 14, 10, 19, 20, 102, 14, 7, 16, 3, 143, 143, 21, 152, 9, 17, 16, 111, 8, 14, 10, 19, 122, 3, 1, 164, 18, 133, 6, 13, 12, 14, 18, 121, 12, 14, 15, 137, 220, 105, 8, 13, 16, 32, 91, 12, 13, 16, 124, 204, 134, 12, 15, 15, 12, 111, 12, 12, 20, 125, 1, 6, 169, 152, 14, 14, 16, 123, 9, 17, 16, 143, 181, 17, 122, 8, 10, 18, 125, 12, 14, 18, 1, 157, 173, 130, 12, 10, 16, 124, 12, 13, 16, 166, 169, 128, 12, 12, 15, 125, 12, 12, 20, 133, 169, 4, 152, 14, 14, 16, 121, 14, 14, 14, 146, 155, 39, 115, 15, 8, 21, 125, 10, 15, 15, 145, 317, 10, 15, 15, 76, 47, 10, 15, 15, 6, 99, 32, 15, 154, 16, 132, 5, 10, 15, 18, 108, 13, 10, 15, 15, 137, 177, 143, 15, 12, 17, 121, 10, 12, 17, 163, 160, 118, 12, 18, 7, 15, 6, 118, 18, 8, 15, 118, 56, 178, 109, 12, 12, 15, 125, 12, 12, 18, 122, 14, 16, 153, 15, 137, 12, 12, 18, 123, 12, 12, 18, 135, 14, 155, 154, 9, 14, 19, 102, 19, 14, 10, 16, 32, 16, 18, 17, 9, 17, 17, 3, 1, 9, 1, 3, 146, 10, 15, 137, 12, 9, 18, 30, 95, 12, 12, 18, 152, 152, 15, 137, 12, 12, 18, 123, 12, 12, 15, 112, 152, 43, 14, 139, 14, 10, 19, 78, 44, 14, 10, 16, 99, 33, 126, 47, 18, 138, 12, 13, 17, 42, 1, 33, 47, 12, 13, 17, 97, 38, 139, 13, 158, 7, 12, 13, 15, 124, 12, 13, 17, 127, 118, 51, 23, 1, 59, 1, 9, 1, 40, 13, 12, 12, 13, 17, 89, 34, 12, 13, 19, 65, 68, 1, 9, 1, 59, 1, 9, 1, 58, 22, 153, 4, 14, 10, 18, 117, 5, 14, 8, 16, 121, 18, 15, 6, 139, 163, 7, 13, 14, 124, 14, 13, 14, 137, 15, 154, 16, 136, 14, 13, 14, 124, 14, 8, 16, 48, 1, 69, 21, 9, 117, 43, 136, 5, 10, 14, 11, 17, 109, 14, 14, 11, 17, 135, 3, 148, 9, 159, 14, 14, 15, 124, 14, 11, 17, 118, 70, 1, 9, 1, 59, 1, 23, 9, 160, 17, 14, 15, 101, 1, 22, 14, 11, 17, 109, 26, 39, 1, 60, 1, 25, 43, 8, 122, 22, 12, 13, 18, 25, 1, 69, 26, 12, 13, 18, 113, 5, 52, 1, 88, 39, 12, 122, 17, 12, 13, 18, 117, 5, 12, 13, 18, 122, 13, 9, 172, 136, 12, 13, 16, 124, 12, 13, 16, 128, 151, 26, 16, 136, 12, 13, 18, 87, 35, 12, 13, 16, 120, 130, 56, 126, 26, 11, 14, 16, 123, 11, 14, 16, 73, 63, 16, 136, 122, 47, 14, 11, 14, 125, 14, 11, 17, 109, 26, 14, 155, 15, 137, 11, 14, 16, 123, 11, 14, 16, 136, 16, 153, 15, 137, 14, 11, 14, 125, 14, 11, 17, 114, 17, 17, 10, 15, 13, 17, 13, 16, 17, 15, 19, 18, 140, 11, 13, 12, 17, 123, 13, 12, 17, 89, 47, 17, 152, 92, 60, 13, 12, 17, 123, 13, 12, 17, 85, 51, 16, 309, 13, 12, 17, 123, 13, 12, 17, 136, 16, 153, 17, 136, 13, 12, 17, 54, 69, 13, 12, 17, 140, 110, 55, 15, 44, 92, 6, 6, 13, 17, 8, 116, 13, 8, 17, 135, 5, 17, 152, 117, 35, 11, 13, 18, 123, 11, 13, 18, 118, 117, 69, 15, 137, 13, 13, 15, 124, 13, 13, 15, 137, 17, 152, 15, 137, 11, 13, 18, 135, 13, 15, 103, 17, 9, 17, 3, 18, 43, 16, 8, 16, 86, 116, 11, 14, 15, 123, 14, 11, 17, 150, 1, 145, 162, 11, 14, 15, 123, 8, 18, 15, 143, 5, 5, 309, 14, 11, 17, 123, 14, 11, 17, 136, 17, 152, 16, 136, 14, 11, 17, 123, 5, 8, 11, 17, 12, 13, 12, 14, 12, 5, 14, 12, 1, 1, 10, 6, 3, 1, 2, 36, 106, 191, 12, 12, 18, 109, 13, 12, 12, 20, 141, 7, 3, 134, 17, 14, 20, 118, 14, 10, 19, 123, 14, 10, 16, 137, 15, 27, 223, 56, 10, 15, 15, 53, 70, 10, 15, 18, 107, 27, 173, 7, 3, 137, 16, 3, 5, 18, 104, 18, 16, 10, 15, 136, 8, 143, 14, 17, 117, 19, 20, 6, 15, 123, 16, 3, 5, 18, 134, 164, 5, 15, 137, 15, 27, 122, 19, 6, 16, 137, 15, 19, 281, 6, 16, 12, 13, 85, 39, 24, 18, 24, 14, 12, 8, 14, 12, 13, 24, 14, 36, 280, 12, 12, 18, 109, 13, 12, 12, 18, 135, 15, 6, 244, 51, 12, 12, 18, 123, 12, 12, 18, 9, 94, 1, 48, 142, 6, 16, 131, 6, 14, 10, 19, 123, 14, 10, 16, 137, 15, 23, 257, 22, 10, 15, 18, 46, 75, 10, 15, 18, 161, 142, 15, 137, 19, 6, 15, 125, 15, 3, 2, 18, 147, 8, 170, 135, 20, 6, 18, 121, 16, 23, 138, 316, 5, 19, 6, 16, 124, 15, 25, 120, 173, 17, 143, 9, 14, 10, 16, 120, 4, 14, 14, 16, 47, 1, 89, 9, 139, 13, 134, 27, 14, 10, 19, 123, 9, 17, 16, 100, 64, 122, 153, 20, 12, 14, 18, 117, 12, 14, 15, 166, 143, 146, 7, 12, 13, 16, 124, 12, 13, 16, 132, 152, 109, 68, 12, 12, 18, 123, 12, 12, 20, 133, 135, 38, 117, 31, 14, 11, 18, 123, 14, 11, 18, 104, 52, 124, 1, 34, 14, 112, 19, 14, 13, 16, 122, 14, 13, 14, 154, 147, 121, 40, 13, 14, 14, 124, 13, 13, 14, 137, 161, 115, 49, 12, 13, 16, 124, 12, 13, 18, 134, 165, 143, 14, 14, 11, 140, 13, 11, 17, 157, 134, 14, 107, 49, 12, 13, 17, 118, 12, 13, 17, 165, 155, 35, 99, 6, 12, 13, 17, 123, 12, 13, 17, 107, 16, 143, 39, 14, 138, 16, 26, 5, 117, 16, 3, 7, 15, 137, 5, 151, 9, 18, 134, 15, 27, 109, 14, 15, 10, 16, 157, 148, 12, 18, 73, 50, 12, 12, 18, 123, 12, 12, 18, 17, 85, 33, 16, 153, 12, 22, 109, 9, 16, 12, 18, 100, 23, 12, 12, 18, 144, 152, 165, 12, 12, 15, 125, 12, 12, 20, 158, 143, 9, 144, 14, 10, 19, 121, 14, 14, 14, 154, 138, 10, 122, 38, 11, 15, 15, 123, 11, 15, 15, 107, 218, 107, 28, 11, 15, 15, 123, 11, 15, 15, 135, 126, 43, 5, 68, 1, 40, 35, 4, 14, 10, 19, 104, 14, 18, 10, 19, 126, 159, 9, 156, 11, 14, 17, 3, 120, 11, 14, 17, 6, 66, 8, 51, 6, 71, 249, 71 }; void setup() { // iterate over the notes of the melody: for (int thisNote = 0; thisNote < numberOfNotes; thisNote++) { if (pgm_read_word_near(melody + thisNote) > 0) { tone(5, pgm_read_word_near(melody + thisNote)); } else noTone(5); delay(pgm_read_word_near(noteDurations + thisNote)); } } void loop() { // no need to repeat the melody. }