La declaración de la cadena de sonido cuelga el compilador Arduino

I have a string of characters from an 8 but the Vehiculos "WAV" file that I'm trying to import into my Arduino project. I declare it like this

const unsigned char sounddata_data[] PROGMEM = "€€[fill these brackets in with 6500 other characters]";

When I try to run this code, the compiler doesn't give me any errors. It just hangs and never finishes compiling. I know that it's this line because if I declare this with a shorter string, or with other types of declaration (like putting commas between each char), it works.

Is there a line length limit in the Arduino code that's stopping me?

If I have to just accept this and put commas between every character, is there a good method?

I could always write a simple program to do it, but I have a number of sound files to convert and I want to make it easy and simple to read the code.


I ended up just writing the program. It converts each data byte into ints delimited by commas. It still bothers me that the old way wouldn't work and this way it will take more time, but at least I have something to fall back on

#include <stdio.h>
int main(int argc, char *argv[]) {
    FILE *r, *w;
    unsigned char ch;
    r = fopen(argv[1], "rb");
    w = fopen("out.txt", "w");
    while (fscanf(r, "%c", &ch) != EOF) {
        fprintf(w, "%d, ", (int)ch);
    return 1;

preguntado el 10 de marzo de 12 a las 09:03

1 Respuestas

If it's a line length problem then you can break up strings like this:

const unsigned char sounddata_data[] PROGMEM = "€€[fill these brackets "
                                               "in with 6500 "
                                               "other chars]";

respondido 10 mar '12, 09:03

I just tried splitting it up. It's giving me a new error. \u0081 is not a universal character. Arduino seems to be picky... - RasTheDestroyer

I think only ASCII characters are valid in a string literal. - Paul R

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.