Getting Started

(lily) #1

Chapter 8: C Pointers and Arrays


// pointer-array with pointers to the song arrays
// mt: flash int flash Songs[] = { FurElise, Mozart,
// /
Minuet, AuldLangSyne,/ Sirene1, Sirene2, Whistle, 0};
const int
Songs[] PROGMEM = { FurElise, Mozart, Minuet,
AuldLangSyne, Sirene1, Sirene2, Whistle, 0};


//mt: flash char flash *TEXT_SONG_TBL[] = { TEXT_SONG1,


fferent songs in flash

directory.

file from the WinAVR port of the Butterfly code, bf_gcc
hanges, we’ll just steal the whole
ing.

ages.h file to:

nst = "\rYou are talking to the ";

32,145, 32,150, 32,155, 32,160, 32,165, 32,170, 32,175,
32,180, 32,185, 32,190, 32,195, 32,200,
0, 0
};


// TEXT_SONG2, /TEXT_SONG3, TEXT_SONG4,/TEXT_SONG5, TEXT_SONG6,
// TEXT_SONG7, 0};
//// mt: 16 ram-bytes (8 words) "wasted" - TODO
//// PGM_P TEXT_SONG_TBL[] PROGMEM = { TEXT_SONG1, TEXT_SONG2,
// /TEXT_SONG3, TEXT_SONG4,/TEXT_SONG5, TEXT_SONG6, TEXT_SONG7,
// 0};
const char *TEXT_SONG_TBL[] = { TEXT_SONG1, TEXT_SONG2,
TEXT_SONG3, TEXT_SONG4, TEXT_SONG5, TEXT_SONG6, TEXT_SONG7, 0};


//__flash char PLAYING[] = "PLAYING";
const char PLAYING[] PROGMEM = "PLAYING";


//mt: int __flash pSong; //pointer to the di
const int
pSong; // mt point to a ram location (pointer array Songs)


static char Volume = 80;
static char Duration = 0;
static char Tone = 0;
static char Tempo;


Save tunes.h to the Play it again Sam


Copy the sounds.h
directory to the Play it again Sam directory. No c
th


Change the contents of the mess


// identify yourself specifically
co char TALKING_TO[] PROGMEM

Free download pdf