The Gameduino library

The Gameduino library supports both Gameduino 2 and 3 -- it auto-detects the attached board at startup. The library is tested with Arduino, ESP8266 and Teensy controllers.

The current version of the GD2 library is 1.2.1. It supports GD2, GD3 and GD3X.

To install it:

  1. download the library
  2. install it in the Arduino IDE. Instructions for doing this are at
  3. restart the Arduino IDE, and load one of the sketches, for example File Sketchbook libraries Gameduino2 1.Basics helloworld

Some examples don't need a microSD card, some do (see the FAQ for a list). To prepare a card, format it and copy the files in to it.


The Gameduino 2/3 printed book is available from Amazon USA, UK, France and Germany.

The Gameduino 2/3 online book is available as a PDF download. A Chinese translation by YunFei Robotics Laboratory is also available for download.

The asset converter

The asset converter is a program that prepares media on your PC for use with the Gameduino 2/3. You can use the asset converter to:

  • convert sprite graphics for the Gameduino2
  • convert audio samples
  • convert TrueType (TTF) fonts

After installation, you can run the asset converter by typing:

gd2asset --help


gd3asset --help

into a command shell. You should see something like:

usage: gd2asset <options> <assets>

  -o   output header file
  -f   output asset file (default is header file)

If no output header file is given, then "default_assets.h" is used

Each asset is a filename, optionally followed by some var=val
assignments. For example:
  pic1.png                 image, format ARGB4
  pic2.jpg,format=L8       image, format L8
  serif.ttf,size=16        font, 16 pixels high

The assets are compiled into flash, or if the "-f" option is given
into a file. In this case the file should be copied to the
microSD card.
In either case, calling LOAD_ASSETS() from the program loads all

There are two ways of storing assets. The first is to use an array in Arduino flash memory. This works well for small sized assets, up to around 20K. The second way is to load the assets from SDcard memory.

If you run it like this:

gd2asset -o myassets.h pic1.png pic2.png pic3.png

then it creates a file myassets.h. Add it to your Arduino sketch, and in your sketch do:

#include "myassets.h"

and after GD.begin(), do:


and you can use the assets pic1, pic2, pic3, for example:

GD.Vertex2ii(10, 100, 0); // pic1
GD.Vertex2ii(10, 200, 1); // pic2
GD.Vertex2ii(10, 300, 2); // pic3

If you run gd2asset like this:

gd2asset -f myassets.gd2 -o myassets.h pic1.png pic2.png pic3.png

then it creates two files:

  • myassets.gd2 - copy this onto your microSD
  • myassets.h - include this from your program

Copy myassets.gd2 to the SDcard, and the sketch can use the assets as above. The only difference is that the data is stored on the SDcard instead of taking up flash memory.

Installation on Debian/Ubuntu

The Gameduino 2 asset converter is available at

If your system does not already have easy_install and PIL:

sudo apt-get install python-setuptools python-imaging

then you can install the asset converter with:

sudo easy_install -U gameduino2

and run it by typing:


Installation on Windows

You can use pre-built executables. For GD2 use:

And for GD3 use:

If you prefer to run it as a Python script, then you must first install:

  1. Python27,
  2. easy_install from
  3. The Python Imaging Library, Choose the version for Python 27.

After this you can open a command windows and type:

\Python27\Scripts\easy_install -U gameduino2

You should see something like this:

This installs the Python package gameduino2 and the command-line utility gd2asset.

After setup you can run it with a command-line like this:

\Python27\python \Python27\Scripts\gd2asset

For general help about setting up Python tools on Windows, see