3.b.3. Command 176: Play Melody

Effect: Plays the desired melody stored in EEPROM. It is possible to store up to 8 melodies using the Store Note (168—Section 3.b.4) and End Melody (224—Section 3.b.5) commands. If the melody doesn’t exist you will either get no response or will possibly hear some garbage melody, depending on the state of the mega168’s EEPROM. One way to get a garbage melody would be to store eight melodies (0 – 7), perform a hardware reset, and then store two different melodies (0 and 1). The pointers for melodies 2 through 7 were not updated by the most recent store commands, however the notes in EEPROM have changed and have potentially overwritten a portion of the old melodies 2 – 7). Attempting to play melody 2 could result in some unexpected sequence of notes. One way to avoid this situation is to issue an “Erase Melodies” command (186—Section 3.b.6) before storing a new set of melodies, however this is purely optional.

Values sent: melody (3 bits)

command byte = 176 | melody