Page 1 of 1

Program Gamebuino with load_game

PostPosted: Sat Aug 09, 2014 12:48 pm
by jackB
Why it doesn' t work ?
Code: Select all
#define load_game (*((void(*)(const char* filename))(0x7ffc/2)))

void setup() {
  Serial.begin(9600);
  Serial.println("Send a char to start...");
  char name[]="BLINK";
}

void loop() {
  if (Serial.available()) {
    Serial.read();
    load_game(name);
  }
}

Re: Program Gamebuino with load_game

PostPosted: Sat Aug 09, 2014 12:51 pm
by rodot
Probably because you don't have a program named BLINK.HEX on your micro SD card?

Re: Program Gamebuino with load_game

PostPosted: Mon Aug 11, 2014 1:29 pm
by jackB
When i write this it works..
Code: Select all
#define load_game (*((void(*)(const char* filename))(0x7ffc/2)))

void setup() {
  Serial.begin(9600);
  Serial.println("Send a char to start...");
}

void loop() {
  if (Serial.available()) {
    Serial.read();
    load_game("BLINK");
  }
}


But when i write this it doesn' t work
Code: Select all
#define load_game (*((void(*)(const char* filename))(0x7ffc/2)))

void setup() {
  Serial.begin(9600);
  Serial.println("Send a char to start...");
}
char name[]="BLINK";
void loop() {
  if (Serial.available()) {
    Serial.read();
    load_game(name);
  }
}


Why?

Re: Program Gamebuino with load_game

PostPosted: Mon Aug 11, 2014 1:49 pm
by ripper121
do you have test String name = "BLINK"; ?

Re: Program Gamebuino with load_game

PostPosted: Tue Aug 12, 2014 7:51 pm
by Myndale
jackB wrote:But when i write this it doesn' t work


Are you sure you're using the latest version of the Arduino IDE and compiler? You're not using a compiler that's placing the global char[] in PROGMEM by any chance?