Dusting off the Nanos
It’s been a while! I thought this might be a good way to refresh my mind on Arduino. The official Arduboy uses the same chip as the Arduino Micro, but several users have been able to cobble together Arduino Nano clones to test out the libraries.
I hooked up my devboard and FTDI cable and uploaded a basic blink sketch to make sure everything was working. In the past I had trouble with the USBs on my Nanos so we’ll just bypass that altogether now and use an FTDI connection. I then updated the Arduino IDE. There was a change made to the official Arduino Nano boards in 2018 and some older boards must use ATMega329P (Old Bootloader). EunChan Park’s video, Solution Why Arduino Nano NOT Uploaded (2019) explains. I find I can only upload scripts with the new Bootloader.
harbaum’s SLIMBOY schematic:
Setting up Arduboy2
The Arduboy Quickstart Guide recommends installing all Arduboy-related libraries:
- Arduboy2 (For Nano we will not be using MLXXXp’s library, we will be using harbaum’s fork)
- ArduboyTones (harbaum’s port)
- ATMlib (harbaum’s port)
- FixedPointsArduino (Pharap)
In the Arduino IDE, select: Sketch > Include Library > Manage Libraries…
Since we are using harbaum’s Arduboy2 library we will need to get it directly from GitHub and add the library manually (check Documents/Arduino/libraries/)
The official Arduboy uses an Arduino Micro, and the board type for uploads is the Arduino Leonardo. However, we are using the Nano, and in Tech Maker’s Arduboy Nano video tutorial they set board as Arduino Nano. (They use the old bootloader but, again, my boards use the new one. Test a basic sketch to see which you need.) Tools > Board: “Arduino Nano”
The Arduboy2 library has several example sketches. File> Example > Arduboy2 > Buttons
I remind myself with Nanos you must hit the reset button when uploading (not compiling). The button sketch allowed me to test buttons and I saw two were miswired (wheee). I tried Ardubreakout next and it worked like a charm.
One of the reason I’m interested in the Arduboy is I can program my own games and tweak existing ones. That means I can make a game like Ardubreakout 5-year-old friendly with a larger, slower ball, for example. harbaum has tested several games, including Shadow-Runner, VIRUS-LQP-79, Pinball, and Nineteen43.
- Shadow-Runner (SHRUN_AB) is a neat endless runner. It requires harbaum’s port of ArduboyTones.
- VIRUS-LQP-79 is a top-down 2D adventure game in which you shoot zombies and rescue neighbors (reminds me of a cross between Zelda and Zombies Ate My Neighbors)
- Pinball is what it says on the tin.
- Nineteen43 is based on the shooter 1943: The Battle of Midway
There are hundreds of Arduboy games and the directory has a browser emulator which is amazing and THANK YOU SO MUCH. There is also Erwin’s Arduboy Collection. I found several games I thought would be a good fit for Minnow. I haven’t tried them all yet.
- Ardu-Man Pac-Man clone
- Unicorn Dash endless runner
- ArduSnake OR
- Snakeling (MLXXXp port)
- Blocks warehouse box game
Migrating Arduboy sketches to Arduboy2
On a whim I decided to try CDRXavier’s PONG and found I could not compile it. Following the Arduboy2 guidelines for migrating sketches, I updated the library includes and switched to the ArduboyTones library and had no trouble getting PONG to run on my Nano.
Well, this was a fun test for sure, but the breadboard setup is not going to cut it. The official Arduboy comes in a credit-card sized case and runs on a 180 mAh Thin-Film Lithium Polymer rechargeable battery which is good for up to 8 hours. Currently, it only holds 1 game at a time because it has no external storage. This is not necessarily a problem, however, little kids can be overwhelmed with choices. I am less concerned with memory limits and battery power than I am with form factor.
I made a devboard, but there’s room for improvement. I’d like to do is incorporate a joystick. The button pinout is defined in Arduboy2Core.h and uXe suggests the replacement code for buttonsState(). filmote’s Don’t like the default behaviour? Extend and overwrite it! explains how to override Arduboy2 source library code. I’m also looking at a 2.42" screen and flash storage.