Hello, all! I need help with my code or the IDE possibly. Whenever I verify or compile the code, the Arduino IDE doesn’t present me with any errors, yet when I upload it to my Arduboy, it would either display nothing or it would display the last image the Arduboy was on before compiling, when it should illustrate the 2-D Array. Any help would be much appreciated!
Edit: It also gave me a usb malfunction message, so proceed with caution if you’re considering compiling this code to your Arduboy, as it might be tricky to reflash it afterwards.
#include <Arduboy2.h>
#include <EEPROM.h>
Arduboy2 arduboy;
BeepPin1 beep;
const uint8_t levels[8][12]
{
//Lv1
{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
uint8_t block[8][12];
uint8_t GameState;
struct Construct
{
void levelCreate()
{
uint8_t a;
for(uint8_t e; a<=8; ++e)
{
block[a][e]=levels[a][e];
if(e == 12 && a != 8)
{
e=0;
a+=1;
}
}
}
};
struct Illustrate
{
void levelVisuals()
{
arduboy.fillRect(0, 0, 96, 64, WHITE);
uint8_t a;
for(uint8_t e; a<=8; ++e)
{
switch(block[a][e])
{
case 1:
arduboy.fillRect((e*8), (a*8), 8, 8, BLACK);
break;
}
if(e == 12 && a != 8)
{
e=0;
a+=1;
}
}
}
};
Construct construct;
Illustrate illustrate;
void setup()
{
arduboy.boot();
arduboy.systemButtons();
arduboy.audio.begin();
beep.begin();
arduboy.safeMode();
arduboy.setFrameRate(32);
}
void gameloop()
{
switch(GameState)
{
case 0:
construct.levelCreate();
illustrate.levelVisuals();
break;
}
}
void loop()
{
arduboy.clear();
gameloop();
arduboy.display();
}