Hi. I want to have a struct that contains a string, and a array of ints. And then I want to read those values. Here's what I've managed to do so far.
typedef struct MyStruct
{
int num;
const char * mad;
} MyStruct;
struct MyStruct PROGMEM_getAnything (const struct MyStruct * sce)
{
static struct MyStruct temp;
memcpy_P (&temp, sce, sizeof (MyStruct));
return temp;
}
const char text[] PROGMEM ="help";
const MyStruct test PROGMEM = {5, text};
void setup()
{
Serial.begin(9600);
struct MyStruct test2 = PROGMEM_getAnything (&test);
Serial.println(test2.num);
} // end of setup
void loop() { }
When I do Serial.println(test2.num); I get the right number. But when I do Serial.println(test2.mad); nothing comes up. Does anyone know whats going on?
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.