Errors while exporting compiled binary

I waned to create game for MAKERbuino and i wanted to export hex file so i can test game in emulator before uploading but when i clicked export compiled binary error was saying : unable to compile for board arudino geuino uno
How to fix that problem i just want to export .hex file from my code?

Hey Leo,

Can you please send us your code so that I can try to compile it locally?

This error can be caused by multiple reasons and is usually a result of a syntax error

Ok i will send code tomorow

here is code:

@Leo :slight_smile:…

Please copy and paste the code here, I cannot compile a photo of your code :slight_smile:

Here is code:

#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
void setup(){
gb.begin();
gb.titleScreen(F(“Performance monitor”));
}
void loop(){
If(gb.update()){
Int cpu=gb.getCpuLoad();
Int ram=gb.getFreeRam();
Int batv=gb.battery.voltage;
Int batl=gb.battery.level;
gb.display.println(F("Cpu load: "));
gb.display.println(F(cpu));
gb.display.println(F("Free RAM: "));
gb.display.println(F(ram));
gb.display.println(F("Battery voltage: "));
gb.display.println(F(batv));
gb.display.println(F("Battery level: "));
gb.display.println(F(batl));

If(gb.buttons.pressed(BTN_C)){
gb.titleScreen(F(“Performance monitor”));
}
}
}

And btw when i scrolled up it was saying some F macro errors

Did you compiled code?

Hi Leo,
I’ve taken a look at your code and the error seems to be this:

When printing out text in your programs using the gb.display.print() or gb.display.println() command you can use the F() macro.

When you use the F() macro, also known as the Flash string helper, the string you put inside the brackets is stored in the microcontroller’s flash memory (pretty big), instead of the RAM memory (kinda small).
But the flash string helper only works for strings that you write in the brackets, not for variables.

For example this is OK to do:
gb.display.println(F(“This is an example”));

But this isn’t correct and you will get some F macro errors:
int variable = 1234;
gb.display.println(F(variable));

Hope this helps!

Here’s the corrected code:

#include <SPI.h>
#include <Gamebuino.h>
Gamebuino gb;
void setup(){
gb.begin();
gb.titleScreen(F("Performance monitor"));
}
void loop(){
  if(gb.update()){
    int cpu=gb.getCpuLoad();
    int ram=gb.getFreeRam();
    int batv=gb.battery.voltage;
    int batl=gb.battery.level;
    gb.display.println(F("Cpu load: "));
    gb.display.println(cpu);
    gb.display.println(F("Free RAM: "));
    gb.display.println(ram);
    gb.display.println(F("Battery voltage: "));
    gb.display.println(batv);
    gb.display.println(F("Battery level: "));
    gb.display.println(batl);
    
    if(gb.buttons.pressed(BTN_C)){
      gb.titleScreen(F("Performance monitor"));
    }
  }
}

Thanks i will try this right when i get back home

1 Like