Go Down

Topic: Due Flash Memory (Read 764 times) previous topic - next topic

PascalMcFortran

Hello,

I have a collection of short music samples and effects for a board game. The sounds don't change and would ideally be included with a sketch at compile time.

I would like to burn then into the DUE from the IDE and then read the audio data from FLASH whilst the program is running.

Is this possible?

Thanks
Pascal

Gericom


Hello,

I have a collection of short music samples and effects for a board game. The sounds don't change and would ideally be included with a sketch at compile time.

I would like to burn then into the DUE from the IDE and then read the audio data from FLASH whilst the program is running.

Is this possible?

Thanks
Pascal

You need to do it like this:
Code: [Select]

const byte sound[something] =
{
Data here
};
Subscribe my youtube channel: http://www.youtube.com/user/MKDS3

stimmer

Do you mean like including a binary file into a sketch? I've done it on Linux using inline assembler, I don't know if the same trick will work on Windows or Mac though.

Code: [Select]

extern char binfile[];
asm(   "\n.section .text\n.globl binfile \n binfile : \n.incbin \"/home/user/full/path/to/sketch/file.bin\" \n");

void setup() {
  Serial.begin(115200);
  char tmp[1000];
  for(int i=0;i<999;i++)tmp[i]=*(binfile+i);
  tmp[999]=0;
  Serial.println(tmp);
  Serial.println((long)binfile,HEX);
}

void loop() {
}
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

Go Up