Firmata Sketch

To load the Circuit Playground Firmata sketch you'll first need to make sure the Arduino IDE is setup to program Circuit Playground.  Follow the Circuit Playground guide and make sure you can upload basic sketches like blink to the board.

Next you'll need to install a library which the sketch uses.  Use the library manager in the latest versions of Arduino to search for and install this library:

Finally download the latest version of the Circuit Playground Firmata code from its home on GitHub by clicking the button below:

Unzip the archive and you'll see two folders inside:

  • CircuitPlaygroundFirmata - This is the Arduino sketch you'll load on the Circuit Playground board to make it a Firmata device.
  • Python Examples - These are examples of Python code that can control a Circuit Playground board running the Firmata sketch.

Open the CircuitPlaygroundFirmata sketch in the Arduino IDE and you should see something like the following:

There isn't anything you normally need to change in the sketch, however if you'd ever like to enable debug output on the serial pins (pin 0 and 1 on Circuit Playground) you can uncomment the debug mode line near the top:

Download: file
// Uncomment below to enable debug output.
//#define DEBUG_MODE

With debug mode enabled the serial pins 0 and 1 will output debug text during certain Firmata actions.  You can hook up a USB to serial cable to these pins to read the output (use 9600 baud).

Now make sure Circuit Playground is selected in the Tools -> Board menu, and the serial port for Circuit Playground is selected in the Tools -> Port menu.  Then press the upload button in the Arduino IDE to compile and upload the Firmata sketch.

Note that if the upload fails for some reason try double pressing the reset button on Circuit Playground.  This will force it into bootloader mode and you should see the red LED start pulsing on and off.  As soon as the red LED pulses press upload and try uploading the sketch again.

Once the sketch has successfully uploaded you're all set and are ready to start using Firmata clients to control Circuit Playground.  Continue on to the next page to learn about Python example code to control Circuit Playground.

This guide was first published on Apr 27, 2016. It was last updated on Apr 27, 2016. This page (Firmata Sketch) was last updated on Apr 23, 2019.