ProjectABE (ArduBoy Emulator)

heres a quick blink sketch

// TX RX Blink Demo - KBC :)
#include <Arduboy2.h>

Arduboy2 arduboy;

void setup() {
   arduboy.begin();

}
void lighty(void){
  digitalWrite( LED_BUILTIN_TX,HIGH);
  arduboy.delayShort(500);
  digitalWrite( LED_BUILTIN_RX,LOW);
  arduboy.delayShort(500);
  digitalWrite( LED_BUILTIN_TX,LOW);
  arduboy.delayShort(500);
  digitalWrite( LED_BUILTIN_RX,HIGH);
  arduboy.delayShort(500);
}

void loop() {
lighty();
}

LED’s in order are RX (green) TX(orange)

1 Like

You should be using the following Arduino macros to control the TX and RX LEDs:

TXLED1 // Turn on the TX LED
TXLED0 // Turn off the TX LED
RXLED1 // Turn on the RX LED
RXLED0 // Turn off the RX LED

Using digitalWrite() will pull in a lot of extra code, and you’d have to reverse the polarities for an Arduino Micro based clone.

Likewise, I hope you’re using the Arduboy2 library functions digitalWriteRGB(red, green, blue) or digitalWriteRGB(color, state) to control the RGB LED digitally, or setRGBled(red, green, blue) for analog control.

1 Like

Thanks! I just implemented the two LEDs and uploaded it.

2 Likes

Thanks for the tip on the macros. I just did a quick comparison and the size difference is immense:
Sketch uses 6912 bytes (24%) using the correct macros Vs 7270 bytes (25%) using digitalWrite()

I’ve been toying around with the LED’s over the weekend digitalWriteRGB() is my normal goto due to the timer conflicts when using ArduboyPlaytune.

I have however toyed with and prefer effects like cross-fading using analog and I’m yet to notice any issue with ArduboyTones so its a bonus. I still need to have a proper look at using setRGBled() because I’ve been a bit naughty using pins & arduino code examples.

1 Like

Just tested Ard-Drivin on a Raspberry Pi 3… surprisingly playable! :smiley:
Video in link:

I’m not sure if it should be classed as a bug or a feature but I am able to load oversized (Cathy3k) games without issue.

There’s no bootloader in the emulator, so that makes sense. You won’t be able to build these games in the IDE, though. Unless there’s any harm in the current behaviour, I guess it’s a feature.

Though, if possible, it would be nice to display a warning somewhere, such as:
This sketch is too big for an actual Arduboy

If you’d try to put the sketch on an actual arduboy, wouldn’t you get an error anyway?

The ide will nag it’s too big but a hex might just upload???

Yes, but it would be a shame and inconvenience if someone were to spend a lot of time developing a game using only your emulator, only to discover later that the game can’t run on an actual Arduboy without somehow trimming it down.

I see one use of your emulator as allowing game development without having to continually upload to a real Arduboy for testing.

Edit: I see your point. You still need to compile the game in the IDE before you can use it in the emulator :flushed:

If someone were to use the emulator’s compiler, they’d get an error if the game doesn’t fit on an arduboy.

If they were to use their own compiler and simply use the emulator for testing… they’d have to go out of their way to make an oversized game and the emulator wouldn’t be telling them anything new.

If external tools allow people to upload hex files that don’t fit, a warning could be useful. I could add that to ProjectABE, but the best place for that warning would be in those tools, though.

Would it be useful if the offline builds of ProjectABE had uploading built-in?

On a plus side if compiling for Arduboy+1k people have the ability to include extra (debug) code to test in the emulator without impacting game space.

I had actually considered making a debug board with more space, since it’s hard to debug C++ code that has been compiled with -Os and some games wouldn’t fit with -O0. 128u4, anyone? :stuck_out_tongue:

2 Likes

I just added avrgirl to the Linux x64 build. I’ll make a Windows build when I get back from work. Maybe I can get a Mac build out too.
Simply press “U” and confirm to upload the current game to an arduboy.

Unfortunately, it doesn’t like my Pro Micro based clone so I can’t test. It should work fine, since avrgirl has an Arduboy preset.

Any brave volunteers?

I can test on Windows as I reinstalled it yesterday I have nothing with a full blown Linux OS atm but if your really stuck I can boot into a live distro or setup a pi.

I’m also open to anyone donating a Mac :stuck_out_tongue:

1 Like

I just uploaded a release with @noopkat’s avrgirl for Linux, if anybody wants to test. The windows build is giving me some work and will have to wait a bit.

EDIT: Nevermind, it’s broken.

1 Like

Finally got the Windows test build up… and since it mostly works with my Pro Micro, I expect it to work on an Arduboy too.

Sometimes it gives me an error which I think has to do with the timing between the reset and the upload. This may require some trial-and-error. In the worst case, I’ll make it retry the upload automatically a few times and the user won’t be annoyed too much.

It seems to trigger the bootloader and initialise a reset but then does not find the arduboy on the com port for upload.

v0.7.9 of the online build is up.
You might want to turn down your speakers a bit. :wink:

I’m still tweaking the flasher in the offline builds, but I think I got it to work 100%-ish. Thanks for the testing, @Keyboard_Camper!