Program Gamebuino with load_game

Understanding the language, error messages, etc.

Program Gamebuino with load_game

Postby jackB » Sat Aug 09, 2014 12:48 pm

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);
  }
}
jackB
 
Posts: 4
Joined: Wed Jul 23, 2014 7:31 pm

Re: Program Gamebuino with load_game

Postby rodot » Sat Aug 09, 2014 12:51 pm

Probably because you don't have a program named BLINK.HEX on your micro SD card?
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: Program Gamebuino with load_game

Postby jackB » Mon Aug 11, 2014 1:29 pm

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?
jackB
 
Posts: 4
Joined: Wed Jul 23, 2014 7:31 pm

Re: Program Gamebuino with load_game

Postby ripper121 » Mon Aug 11, 2014 1:49 pm

do you have test String name = "BLINK"; ?
User avatar
ripper121
 
Posts: 224
Joined: Fri Apr 04, 2014 2:02 pm
Location: Germany

Re: Program Gamebuino with load_game

Postby Myndale » Tue Aug 12, 2014 7:51 pm

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?
Myndale
 
Posts: 507
Joined: Sat Mar 01, 2014 1:25 am


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 66 guests