Thanks. I like your 2nd example, but I can't figure out why I get the error
printTuneArray was not declared in this scope
//
// testTunes.pde
//
// Demonstration of getting values from a _FLASH_TABLE
//
// davekw7x
//
#include <Flash.h>
#include "Tone.h"
FLASH_TABLE(int, Tune1, 5, /* Number of notes in the tune */
{NOTE_C5, NOTE_D6, NOTE_C6, NOTE_B5, NOTE_C6},
{20,20,4,10,4});
FLASH_TABLE(int, Tune2, 3, /* Number of notes in the tune */
{NOTE_C6, NOTE_B5, NOTE_A5},
{20,8,4});
FLASH_ARRAY(int, Tune3,
NOTE_C6, 20,
NOTE_D6, 20,
NOTE_C6, 4,
NOTE_B5, 10,
NOTE_C6, 4)
// Arduino will not automatically create prototypes for function templates,
// so you have to put it in before the function is invoked.
//
void printTuneTable(const _FLASH_TABLE<int> & ft);
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println("Calling printTuneTable(Tune1)");
printTuneTable(Tune1);
Serial.println("Calling printTuneTable(Tune2)");
printTuneTable(Tune2);
Serial.println("Calling printTuneTable(Tune3)");
printTuneArray(Tune3);
delay(10000);
}
void printTuneTable(const _FLASH_TABLE<int> & ft)
{
for (int i = 0; i < ft.cols(); i++) {
Serial.print("Note ");Serial.print(i);
Serial.print(": Tone = ");Serial.print(ft[0][i]);
Serial.print(", duration = ");Serial.println(ft[1][i]);
}
Serial.println();
}
void printTuneArray(const _FLASH_ARRAY<int> & fa)
{
for (int i = 0; i < fa.count()-1; i += 2) {
Serial.print("Note ");Serial.print(i);
Serial.print(": Tone = ");Serial.print(fa[i]);
Serial.print(", duration = ");Serial.println(fa[i+1]);
}
Serial.println();
}