User Tools

Site Tools


This is an old revision of the document!

RTArduboy Simulator

See a Vine of it in action here.

What does it do?

It's a harness to run code written for the Arduboy in Visual C++ 2005. It fakes the Arduboy API (Based on V1.2 of the Arduboy library) so I can test and debug my stuff in my favorite development environment. The identical code can then be run on the real Arduboy.

Features/Good stuff
  • Runs the Arduboy examples at full speed
  • Can interact with the mouse (click the buttons, easy) or the keyboard
  • Pixel perfect simulation, includes AbPrinter, WCharacter, WString, etc
  • Code pieces that lacks reentrancy (like a giant while loop until a key is pressed) work ok
Issues/Bad stuff
  • This is NOT an emulator that can run Arduino binaries. It's a simulator that can compile Arduboy Arduino sketches - so this is only useful if you are a developer!
  • No EEPROM simulation (eeprom.h exists but it just stubs stuff out to avoid errors)
  • No audio simulation (ArduboyPlaytune.h exists but it just stubs stuff out to avoid errors)
  • No LED light simulation, those commands will just do nothing
  • Somewhat hacky, only works with Windows. Wouldn't be tough to fix that and make it worth with other things though, for example, a html5 export shouldn't be too hard hard
  • Unfortunately optimized stuff like TEAM a.r.g's games won't run because they don't use the original Arduboy.h/cpp class. You'd have to modify Arglib in a similar way for it to work, or add any missing things to my version of the Arduboy class.
How to compile and run it as is

By default I've included a slightly modified version of Arduboy's breakout example. To run it, open the Visual Studio project and compile the “Debug GL” or “Release GL” configuration.

Hopefully it runs!

How to convert your own Arduboy code/sketch to run
  • Add your sketch files to <proton install dir>/RTArduboy/Arduboy. (you should probably delete break_outbitmaps.* as your sketch likely doesn't use them)
  • Replace ardu_main.cpp with the contents of your .ino file. Delete your .ino file, you won't need it anymore, Arduboy.ino will be used instead
  • Rename begin() and loop() to main_being() and main_loop()
  • You can now try compiling. Likely it will fail with a bunch of errors because Visual C++ isn't automatically creating function declarations now that it's a normal .cpp file. Create your own (example: void myfunction();) and paste them at the top of the .cpp or in its .h file.
  • Your thing might run now! If not, it's probably because of something I'm not simulating yet and you'll have to add it
How to run your converted sketch on the real Arduino

Just double click <proton install dir>/RTArduboy/Arduboy/Arduboy.ino and compile and install like usual, it should work. You can zip up just that dir if you want to give the Sketch source to somebody, it works the same as usual despite the tweaks.

  • Maybe there is a better way than the dummy .ino file calling main_begin() and main_loop(), dunno, but this does work.
  • Most code is copied from the Arduboy/Arduino project and not mine. Feel free to use/steal any the stuff I wrote in the RTArduboy or /shared/Arduboy directory trees as needed.
proton/rtarduboy.1464334517.txt.gz · Last modified: 2016/05/27 07:35 by seth