Adding programs (sketches) to the Arduino IDE


This guide provides instructions on how to add games and other programs into the Arduino Integrated Development Environment (IDE) so you can upload them to your Arduboy. In the Arduino world, a program is called a sketch.

You should already have installed the Arduino IDE according to the instructions found in the Arduboy Quick Start Guide and those provided by the Arduino organization.

Location of Sketches

The IDE calls the place that contains your sketches the Sketchbook (makes sense, right? :wink:) but unless it’s been changed, the actual folder will likely be named Arduino. In this guide, it will still be referred to as the Sketchbook, so substitute the correct folder name accordingly.

By default, the folder for the Sketchbook, using your operating system’s graphical environment (GUI), will be:

  • Windows: the Arduino folder in your Documents folder
  • Mac: the Arduino folder in your Documents folder
  • Linux: the Arduino folder in your Home folder

You can verify the folder that your IDE is using for the Sketchbook by selecting from the IDE menus:
File > Preferences
In the Settings tab there will be a field near the top called Sketchbook location, which will contain the full path to your Sketchbook folder. (You can change this path to use a different folder for your Sketchbook but it’s not recommended unless you’re sure you know what you’re doing.)

Each sketch will have it’s own folder within the Sketchbook. Though not necessary, if you wish you can organize your sketches into sub-folders within the Sketchbook. For instance you could have sub-folders called:

  • Action Games
  • Puzzle Games
  • Demos
  • My Development

You can nest sub-folders as deep as you wish.

Note: In your Sketchbook there will be a folder named libraries
Leave the libraries folder alone and don’t try to put sketches in it.

Sketches located within the Sketchbook will be opened by selecting from the IDE menus:
File > Sketchbook
If you can’t find a sketch using File > Sketchbook then it hasn’t been installed properly.

Sketch Files

The main file for a sketch will have the extension .ino (the last three letters of Arduino). When a .ino file is loaded into the IDE, the extension will not be shown in its tab. For many sketches this will be the only file required but it’s possible that a sketch may have more than one file with the .ino extension.

Some sketches may also have additional files containing extra code to support the .ino file(s). These files will have the extensions .c .cpp or .h

If you get “No such file” type errors when you try to verify a sketch or upload it into your Arduboy, it’s possible that one or more of these additional files is missing in the sketch’s folder.

Sketch Folder Name

The name of the folder containing the file(s) for a sketch must have the exact same name as the main .ino file, with the .ino extension removed. E.g. If the sketch’s main file is called SuperGame.ino the folder must be named SuperGame

Adding Sketches to your Sketchbook

You can add sketches to your sketchbook either from within the IDE or by a means outside of the IDE.

Many sketches are supplied as a .zip or other archive file containing the sketch file(s). I find it easiest to extract the archive to a temporary working folder and then copy or move the required files to the Sketchbook. This is because the extracted files and folders may not be arranged the way they need to be. There may also be extra unneeded files such as templates or artwork used for developing the sketch.

Don’t download the archive files or other sketch files directly to your Sketchbook. Save them in your Downloads folder or some location other than your Sketchbook. In most cases, the “working folder” can just be the one that’s created when you extract the contents of the archive file. Once the sketch is installed in your Sketchbook, you can delete the archive file and working folder(s), if desired.

Some sketches, especially those that just consist of a single file, may be listed on a web page as text but not available for download. You can copy and paste this text directly into the IDE and save it (see “From Text on a web page” below).

Adding a downloaded Sketch without using the IDE

The IDE should be closed and not running when adding the sketch so the IDE can find it when opened. (The IDE only indexes sketches when it first starts.)

  1. If the file is a .zip or other archive, extract it to a working folder. Otherwise, you should have a working folder containing the .ino file(s) plus any associated .c .cpp or .h files that you downloaded.
  • Create a folder in your Sketchbook (or in a sub-folder under it) with exactly the same name as the main .ino file but without the .ino extension. E.g. for SuperGame.ino name the folder SuperGame

  • Copy the main .ino file and any additional .ino file(s), plus any .c .cpp or .h files, found together in the same working folder, into the new folder that you created in your Sketchbook.

  • Special Case: (Actually, this will apply to many archives.) If it looks like extracting the archive file created a folder or sub-folder named the same as the .ino file in it, then likely the archive was arranged properly. You can just copy or move this folder and its contents to your Sketchbook, instead of creating a folder and copying individual files.
    Similarly, you may just have to slightly rename the folder. For example, with .zip files downloaded from Github you may have to remove -master from the end of the folder name.

You should now be able to open the IDE and load your new sketch by selecting from the menus:
File > Sketchbook
The loaded sketch should be the ready to verify and/or upload.

Adding a Sketch using the IDE

From Downloaded file(s)

  1. If the file is a .zip or other archive, extract it to a working folder. Otherwise, you should have a working folder containing the .ino file(s) plus any associated .c .cpp or .h files that you downloaded.
  • In the IDE, select from the menus:
    File > Open...
    Open the main .ino file found somewhere in your working folder. If you get a pop-up titled Moving, asking to move the file to a folder of the same name, select OK. Note that moving the main .ino file will leave associated .ino .c .cpp or .h files, if any, in their original location, so keep this in mind for the next steps. Opening the .ino file in the IDE doesn’t move it to your Sketchbook so make sure you follow the next step.

  • Select from the IDE menus:
    File > Save As...
    This will open a dialog to create a new folder containing a .ino file of the same name. Navigate to, and save it, in your Sketchbook or a sub-folder within the Sketchbook.

  • If there are any more .ino files or .c .cpp or .h files in the same folder as the main .ino file in your working folder (or in the folder below if the pop-up moved the main .ino file):

  • Select from the menus:
    Sketch > Add File...

  • Select the file. It will appear in a new tab in the IDE.

  • Repeat for any other .ino .c .cpp or .h files.

The sketch should now be ready to verify and/or upload.

From Text on a web page

  1. When you start the IDE, the editing window may contain a basic sketch template (with just empty setup() and loop() functions). If not, you can select from the IDE menus:
    File > New.
    It will be named something like sketch_<today’s date>a in the tab.
  • Delete the template code from the window. (You can use “right click” > Select All, then press the delete key or use “right click” > Delete.)

  • Copy the text from the web page and paste it into the window.

  • If there are other files listed that need to be included, click on the down arrow near the top right and select: New Tab. When prompted, you must name the file whatever the author said it should be called (.ino .c .cpp or .h). Copy the text for the file into the tab’s window. Repeat as necessary.

  • Select from the menus:
    File > Save As...
    Save the sketch somewhere in the Sketchbook using the name of the sketch (the same as the main .ino file without the extension).

The sketch should be the ready to verify and/or upload.

Uploading your Sketch

To upload your new sketch into an Arduboy, refer to the Quick Start Guide.

Have Fun! :grin:

Discuss this topic

If you would like to talk about this Guide, you can do so in your own topic OR go to this one:


Fixed a very small spelling error.

Clarified the location and name of the Sketchbook folder when accessing it from the GUI.

Added a recommendation that Sketchbook folder location not be changed.