Threads are there meta in the gamebuino meta - By hiveplay12345

Author :  hiveplay12345

Hello, today I wanted to create a game
I need a second thread, but I can not do it because an error has occurred
compilation with the gamebuino board

#include <leOS.h>

#include <Gamebuino-Meta.h>
leOS myOS;
void setup() {



void loop(){
// wait until the gamebuino is ready to update at stable 25 FPS
// this also updates sounds, button presses… everything!
int timeclock = 1;
// clear the previous screen

void clocktime


Author :  Sorunome

Hi, mind posting what error you are having?

First off, i'd recommend putting gb.begin(); as first in your setup() function as it initialized the entire board

In general, I'd recommend against multithreading on the gamebuino META, as I see little reason as to why that would be needed. What about having to update multiple things at once? Do them one after another! Something like this:

void loop() {
// update player positions

// update enemies

// interact between players and enemies

// render stuff


The multithreading library you are using may also be dysfunctional due to using timers that the library itself uses for other stuff (sound, etc.)

Author :  Insajd

I'm also curious what design approach you took so that you need multiple threads/processes happening at the same time. Would you mind sharing? We may try to help you with some design decisions if you do.

Also I kind of agree with Sorunome as I don't really see any reason to go with multi thread approach for gamebuino games, but I might be missing something ;)

Author :  hiveplay12345

The game will be similar to the Tiny Tower game
I would like to create a system of time that will be at night during the day
And I need Delay (125);
And you can not do it in an  and during (! Gb.update)

but probably because the idea is in a minimal state because I'm just creating the engine and graphics
But there, I would like to do a game saves

Author :  Insajd

For saving the game you can check docs: There is SAVE section, it may be useful.

As for your design problem: I have never played tiny towers so I don't know which gimmick you want to implement. If you simply want to count real time, then you can count frames. 25 frames makes one second. For the problem with delays, why can't you simply make your day/night cycle equal to 250 and count it from 0? If the value is lower than 125 there is a day. Else it's night. Third possibility I see is that you may want to know real time of the day. I don't know if this is possible, @Sorunome may help you with that.

Author :  hiveplay12345

Actually I'm on vacation and not thinking :)

Author :  Sorunome

And I need Delay (125);

You could actually call arduinos delay(125); in your code, the updating stuff will still happen. That is not recommended however. Instead, try what @Insajd suggested: instead of pausing 125 milliseconds, why not wait for six frames?

Author :  dreamer3

Hiveplay, if you look you'll also see the M0+ ARM CPU we use isn't supported by the library you're trying to use (LeOS).  As most people have mentioned to do most simple timing things you really don't need a scheduler like that at all.