Last two weeks I try to code something for long time. I chosed Arduboy for this scope, is simple & open.
Last time I tryed to code is 32 years ago with my first computer ZX Spectrum.
Start with a game “inspired” by Moon Patrol, because I think is enought simple and I can try to implement one thing at a time (background, terrain, car, shot, jump…).
On Vol.3 Arduboy Magazine i discovered that @metalidol made almost same game. Great! Now I can compare my little solution with code well write.
Very cool! Yeah, I watched the video before reading your post, thinking, “Hey, I’ve seen an anime game like this, before.” It’s cool you saw it in the Arduboy Magazine. I think it’s really cool to compare code to see how people do the same thing differently.
Ah ah! You make laugh also my wife.
Every line of code I must upload to view the result, because I’m pretty sure to make a mistake. Now, I buy some hardware to develop because I think to wasted at least 1000 of 10000 upload .
If you make a mistake, the console window of the Arduino IDE will help you track down the error. And it won’t upload unless it is error free. You can also compile without uploading to make sure there aren’t errors. It’s a pretty quick process with such small files so feel free to do that as much as you want.
Of course, but when I compile, my finger go instantly on upload sketch because my eyes must see the result .
Anyway, this week I’m able to code 10 lines without upload. Little step.
There’s no need to have the pinMode() calls in setup() for the RGB LED. Calling arduboy.boot() will set these pins as outputs properly.
It would also be better to use arduboy.digitalWriteRGB() to control the LEDs instead of digitalWrite(). With the latest version of the Arduboy2 library, arduboy.digitalWriteRGB() can control each LED individually, or all at the same time as before.
It would be better to use arduboy.audio.begin() instead of arduboy.audio.on() in setup(). This way, the user will be able to mute the sound using the system control mute function (hold B during boot up, then while still holding B press UP for sound on or Down for sound off).
Your code generates a few warnings when compiled, so it may not be working exactly as intended. To see these warnings select File > Preferences
in the IDE.
Then set Show verbose output during: compilation
and set Compiler warnings:
to All
You can ignore the EEPROM warnings but you should look into the others.
You don’t need to call arduboy.flashlight(), arduboy.systemButtons() or arduboy.audio.begin() anymore. They are all included in arduboy.begin(). And, if you’re using random() you should include arduboy.initRandomSeed().