/* PROGMEM string demo How to store a table of strings in program memory (flash), and retrieve them. Information summarized from: http://www.nongnu.org/avr-libc/user-manual/pgmspace.html Setting up a table (array) of strings in program memory is slightly complicated, but here is a good template to follow. Setting up the strings is a two-step process. First define the strings. */ #include //song7: // I added SRA, the marker to either record to SP position - if it's a '2' then it should record!!!! // if SP is a 0 then do nothing - if SP is a 1 then playback! // HL HR nu SP SC HH SD BD B eSD eBD nu BR BF nu nu nu /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_0[] PROGMEM = "10021001B00000000"; // "String 0" etc are strings to store - change to suit. prog_char string_1[] PROGMEM = "10020000B00000000"; prog_char string_2[] PROGMEM = "00020000B00000000"; prog_char string_3[] PROGMEM = "00020000B00000000"; prog_char string_4[] PROGMEM = "00021011B00000000"; prog_char string_5[] PROGMEM = "00020000B00000000"; prog_char string_6[] PROGMEM = "00020000B00000000"; prog_char string_7[] PROGMEM = "00020000B00000000"; prog_char string_8[] PROGMEM = "01011001B00000000"; //added sample play here in position 3 all the way through string15 prog_char string_9[] PROGMEM = "01010000B00000000"; prog_char string_10[] PROGMEM = "00010000B00000000"; prog_char string_11[] PROGMEM = "00011101B00000000"; prog_char string_12[] PROGMEM = "00010000B00000000"; prog_char string_13[] PROGMEM = "00011010B00000000"; prog_char string_14[] PROGMEM = "00010000B00000000"; prog_char string_15[] PROGMEM = "00011100B00000000"; // end song 7- // begin PLAYER 0 DATA 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 //b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu prog_char string_16[] PROGMEM = "00021000B01000000"; // SP is set to 2 to record - SRA=1 in original code prog_char string_17[] PROGMEM = "00020000B00000000"; prog_char string_18[] PROGMEM = "00020000B00000000"; prog_char string_19[] PROGMEM = "00020000B00000000"; prog_char string_20[] PROGMEM = "00021000B11000000"; prog_char string_21[] PROGMEM = "00021000B00000000"; // OLD CASE 6 prog_char string_22[] PROGMEM = "00020000B00000000"; prog_char string_23[] PROGMEM = "00020000B00000000"; prog_char string_24[] PROGMEM = "00021000B01000000"; prog_char string_25[] PROGMEM = "00020000B00000000"; prog_char string_26[] PROGMEM = "00020000B00000000"; prog_char string_27[] PROGMEM = "00020000B00000000"; prog_char string_28[] PROGMEM = "00021000B11000000"; prog_char string_29[] PROGMEM = "00020000B01000000"; prog_char string_30[] PROGMEM = "11020000B00000000"; prog_char string_31[] PROGMEM = "01020000B00000000"; // SP is set to 0 to turn off record - SRA=0 in original code // end of player 0 //begin Song0 data 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_32[] PROGMEM = "00010001B00000000"; // SP is set to 1 to play - SRA=0 and SamplePlay=1 in original code only at top of data!!!!!! prog_char string_33[] PROGMEM = "00000000B00000000"; prog_char string_34[] PROGMEM = "00001010B00000000"; prog_char string_35[] PROGMEM = "00000000B00000000"; prog_char string_36[] PROGMEM = "10000101B00110000"; prog_char string_37[] PROGMEM = "01000000B00000000"; prog_char string_38[] PROGMEM = "10001000B00000000"; // OLD CASE 7 - position 3 for SamplePlay changed to 0 - sampler will contine to play whole recorded sample prog_char string_39[] PROGMEM = "01000010B00001100"; prog_char string_40[] PROGMEM = "00000001B00000000"; prog_char string_41[] PROGMEM = "00000000B00000000"; prog_char string_42[] PROGMEM = "00001000B00000000"; prog_char string_43[] PROGMEM = "00000000B00000000"; prog_char string_44[] PROGMEM = "00000101B00000000"; prog_char string_45[] PROGMEM = "00000010B11000000"; prog_char string_46[] PROGMEM = "00001000B00000000"; prog_char string_47[] PROGMEM = "00000010B00000000"; // SP is set to 0 to turn off player // end of Song 0 data // begin Song 1 data 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 // this is the same as the test song 7 except that all of the SamplePlay data is now 0 /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_48[] PROGMEM = "10001001B00000000"; // "String 0" etc are strings to store - change to suit. prog_char string_49[] PROGMEM = "10000000B00000000"; prog_char string_50[] PROGMEM = "00000000B00000000"; prog_char string_51[] PROGMEM = "00000000B00000000"; prog_char string_52[] PROGMEM = "00001011B00000000"; prog_char string_53[] PROGMEM = "00000000B00000000"; prog_char string_54[] PROGMEM = "00000000B00000000"; prog_char string_55[] PROGMEM = "00000000B00000000"; prog_char string_56[] PROGMEM = "01001001B00000000"; //added sample play here in position 3 all the way through string15 prog_char string_57[] PROGMEM = "01000000B00000000"; prog_char string_58[] PROGMEM = "00000000B00000000"; prog_char string_59[] PROGMEM = "00001101B00000000"; prog_char string_60[] PROGMEM = "00000000B00000000"; prog_char string_61[] PROGMEM = "00001010B00000000"; prog_char string_62[] PROGMEM = "00000000B00000000"; prog_char string_63[] PROGMEM = "00001100B00000000"; // begin Song 2 data 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 // this is Song 1 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_64[] PROGMEM = "10011001B00000000"; prog_char string_65[] PROGMEM = "10001000B00000000"; prog_char string_66[] PROGMEM = "10001000B00000000"; prog_char string_67[] PROGMEM = "10001011B00000000"; prog_char string_68[] PROGMEM = "01001000B00000000"; prog_char string_69[] PROGMEM = "01001000B00000000"; prog_char string_70[] PROGMEM = "01001100B01000001"; prog_char string_71[] PROGMEM = "01001000B00000000"; prog_char string_72[] PROGMEM = "10001000B00000000"; prog_char string_73[] PROGMEM = "10000000B00000000"; prog_char string_74[] PROGMEM = "10001000B00000000"; prog_char string_75[] PROGMEM = "10000010B10000000"; prog_char string_76[] PROGMEM = "01001000B00000000"; prog_char string_77[] PROGMEM = "01001000B00000000"; prog_char string_78[] PROGMEM = "01001100B00000000"; prog_char string_79[] PROGMEM = "01001000B00000000"; // begin Song 3 data 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 // this is Song 2 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_80[] PROGMEM = "00011101B00000000"; prog_char string_81[] PROGMEM = "10001000B00100000"; prog_char string_82[] PROGMEM = "10000000B00000000"; prog_char string_83[] PROGMEM = "10000011B00000000"; prog_char string_84[] PROGMEM = "01001000B00010000"; prog_char string_85[] PROGMEM = "01001100B00000000"; prog_char string_86[] PROGMEM = "01000010B00000000"; prog_char string_87[] PROGMEM = "01000000B00000000"; prog_char string_88[] PROGMEM = "10001000B00001100"; prog_char string_89[] PROGMEM = "10000000B00000100"; prog_char string_90[] PROGMEM = "10001000B00000000"; prog_char string_91[] PROGMEM = "10001000B00000000"; prog_char string_92[] PROGMEM = "00000000B10000000"; prog_char string_93[] PROGMEM = "00000100B10000000"; prog_char string_94[] PROGMEM = "00001000B10000000"; prog_char string_95[] PROGMEM = "00000100B10000000"; // begin Song 4 data 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 // this is Song 3 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_96[] PROGMEM = "00011001B00000000"; prog_char string_97[] PROGMEM = "00000000B00000000"; prog_char string_98[] PROGMEM = "01001000B01000000"; prog_char string_99[] PROGMEM = "00001000B00000000"; prog_char string_100[] PROGMEM = "00001110B00000000"; prog_char string_101[] PROGMEM = "00000000B01000000"; prog_char string_102[] PROGMEM = "00001000B00000000"; prog_char string_103[] PROGMEM = "00000001B00000000"; prog_char string_104[] PROGMEM = "00001001B00000000"; prog_char string_105[] PROGMEM = "00001000B00000000"; prog_char string_106[] PROGMEM = "00001001B00000000"; prog_char string_107[] PROGMEM = "10000000B00000000"; prog_char string_108[] PROGMEM = "00001110B10000000"; prog_char string_109[] PROGMEM = "00000000B00000000"; prog_char string_110[] PROGMEM = "00000000B10000000"; prog_char string_111[] PROGMEM = "00000000B00000000"; // begin Song 5 data 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 // this is Song 4 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_112[] PROGMEM = "00010100B00000000"; prog_char string_113[] PROGMEM = "00000000B00000000"; prog_char string_114[] PROGMEM = "00010100B10000000"; prog_char string_115[] PROGMEM = "00000000B00000000"; prog_char string_116[] PROGMEM = "00001100B10000000"; prog_char string_117[] PROGMEM = "00000000B10000000"; prog_char string_118[] PROGMEM = "00000100B10000000"; prog_char string_119[] PROGMEM = "00000101B00000000"; prog_char string_120[] PROGMEM = "00001000B00000000"; prog_char string_121[] PROGMEM = "00000000B00000000"; prog_char string_122[] PROGMEM = "00001001B00000000"; prog_char string_123[] PROGMEM = "00000000B00000000"; prog_char string_124[] PROGMEM = "00001000B00000000"; prog_char string_125[] PROGMEM = "00000000B00000000"; prog_char string_126[] PROGMEM = "00000000B00000000"; prog_char string_127[] PROGMEM = "00000000B00000000"; // begin Song 6 data 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 // this is Song 5 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_128[] PROGMEM = "00001001B00010000"; prog_char string_129[] PROGMEM = "00000000B00000000"; prog_char string_130[] PROGMEM = "00000000B00001100"; prog_char string_131[] PROGMEM = "00000001B00000000"; prog_char string_132[] PROGMEM = "00001110B00000000"; prog_char string_133[] PROGMEM = "00000000B00000000"; prog_char string_134[] PROGMEM = "00000000B00000000"; prog_char string_135[] PROGMEM = "00001000B01000000"; prog_char string_136[] PROGMEM = "00000001B00000000"; prog_char string_137[] PROGMEM = "00001000B10000000"; prog_char string_138[] PROGMEM = "00000100B10000000"; prog_char string_139[] PROGMEM = "00001000B10000000"; prog_char string_140[] PROGMEM = "00001110B00000000"; prog_char string_141[] PROGMEM = "00001000B10000000"; prog_char string_142[] PROGMEM = "00001100B11000000"; prog_char string_143[] PROGMEM = "00000000B00000000"; // begin Song 7 data 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 // this is Song 6 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_144[] PROGMEM = "10001001B00000000"; prog_char string_145[] PROGMEM = "10001000B00000000"; prog_char string_146[] PROGMEM = "10001001B00000000"; prog_char string_147[] PROGMEM = "10001000B00000000"; prog_char string_148[] PROGMEM = "01000110B00000000"; prog_char string_149[] PROGMEM = "01001000B00000000"; prog_char string_150[] PROGMEM = "01001000B00000000"; prog_char string_151[] PROGMEM = "01001000B00000000"; prog_char string_152[] PROGMEM = "10001001B00000000"; prog_char string_153[] PROGMEM = "10000000B00000000"; prog_char string_154[] PROGMEM = "10001001B10000000"; prog_char string_155[] PROGMEM = "10001000B00000000"; prog_char string_156[] PROGMEM = "01001110B01000000"; prog_char string_157[] PROGMEM = "01001000B00000000"; prog_char string_158[] PROGMEM = "01000000B00000000"; prog_char string_159[] PROGMEM = "01001000B01000000"; // begin Song 8 data 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 // this is Song 7 in the original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) (extraSnareDrum)(extraBassDrum)(not used)(BeltReverse)(BeltForward)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_160[] PROGMEM = "00001001B00000000"; prog_char string_161[] PROGMEM = "00001000B00000000"; prog_char string_162[] PROGMEM = "00001000B00000000"; prog_char string_163[] PROGMEM = "00001001B00000000"; prog_char string_164[] PROGMEM = "00001000B00000000"; prog_char string_165[] PROGMEM = "00001000B00000000"; prog_char string_166[] PROGMEM = "00001001B00000000"; prog_char string_167[] PROGMEM = "00001000B00000000"; prog_char string_168[] PROGMEM = "00001001B00000000"; prog_char string_169[] PROGMEM = "00001000B00000000"; prog_char string_170[] PROGMEM = "00001001B00000000"; prog_char string_171[] PROGMEM = "00001000B00000000"; prog_char string_172[] PROGMEM = "00001000B00000000"; prog_char string_173[] PROGMEM = "00001001B00000000"; prog_char string_174[] PROGMEM = "00001000B00000000"; prog_char string_175[] PROGMEM = "00001000B00000000"; // begin Song 9 data 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 // this is a Song original coding data /* //(HeadLeft =0)(HeadRight=1)(not used)(SamplePlay=3)(SpeakerClick=4)(HiHat=5)(SnareDrum=6)(BassDrum=7) B (extraSnareDrum 8)(extraBassDrum 8)(not used 9)(BeltReverse 10)(BeltForward 11)(not used)(not used)(not used) //' b0= HL HR nu SP SC HH SD BD BeSD eBD nu BR BF nu nu nu // B eSD extra Snare Drum(9)/ eBD extra Bass Drum(10) / BBR belt right reverse(11) / BLR belt left reverse(12) / BL belt left(13) / BR belt right(14) / nu / nu / nu */ prog_char string_176[] PROGMEM = "00001010B00000000"; prog_char string_177[] PROGMEM = "00000000B00000000"; prog_char string_178[] PROGMEM = "01001100B00000000"; prog_char string_179[] PROGMEM = "01001100B00000000"; prog_char string_180[] PROGMEM = "00000000B00000000"; prog_char string_181[] PROGMEM = "00001010B00000000"; prog_char string_182[] PROGMEM = "10000000B00000000"; prog_char string_183[] PROGMEM = "10001100B00000000"; prog_char string_184[] PROGMEM = "00001101B10000000"; prog_char string_185[] PROGMEM = "00000000B00000000"; prog_char string_186[] PROGMEM = "01001001B01000000"; prog_char string_187[] PROGMEM = "01001001B00000000"; prog_char string_188[] PROGMEM = "00001001B00000000"; prog_char string_189[] PROGMEM = "00001000B01000000"; prog_char string_190[] PROGMEM = "00001100B00000000"; prog_char string_191[] PROGMEM = "00001100B00000000"; // Then set up a table to refer to your strings. PROGMEM const char *string_table[] = // change "string_table" name to suit { string_0, string_1, string_2, string_3, string_4, string_5, string_6, string_7, string_8, string_9, string_10, string_11, string_12, string_13, string_14, string_15, string_16, string_17, string_18, string_19, string_20, string_21, string_22, string_23, string_24, string_25, string_26, string_27, string_28, string_29, string_30, string_31, string_32, string_33, string_34, string_35, string_36, string_37, string_38, string_39, string_40, string_41, string_42, string_43, string_44, string_45, string_46, string_47, string_48, string_49, string_50, string_51, string_52, string_53, string_54, string_55, string_56, string_57, string_58, string_59, string_60, string_61, string_62, string_63, string_64, string_65, string_66, string_67, string_68, string_69, string_70, string_71, string_72, string_73, string_74, string_75, string_76, string_77, string_78, string_79, string_80, string_81, string_82, string_83, string_84, string_85, string_86, string_87, string_88, string_89, string_90, string_91, string_92, string_93, string_94, string_95, string_96, string_97, string_98, string_99, string_100, string_101, string_102, string_103, string_104, string_105, string_106, string_107, string_108, string_109, string_110, string_111, string_112, string_113, string_114, string_115, string_116, string_117, string_118, string_119, string_120, string_121, string_122, string_123, string_124, string_125, string_126, string_127, string_128, string_129, string_130, string_131, string_132, string_133, string_134, string_135, string_136, string_137, string_138, string_139, string_140, string_141, string_142, string_143, string_144, string_145, string_146, string_147, string_148, string_149, string_150, string_151, string_152, string_153, string_154, string_155, string_156, string_157, string_158, string_159, string_160, string_161, string_162, string_163, string_164, string_165, string_166, string_167, string_168, string_169, string_170, string_171, string_172, string_173, string_174, string_175, string_176, string_177, string_178, string_179, string_180, string_181, string_182, string_183, string_184, string_185, string_186, string_187, string_188, string_189, string_190, string_191, };