Program the Gemma M0

The Gemma M0 can be programmed with either the Arduino IDE or with Circuit Python. For everything you need to know about programming the Gemma M0, visit the handy Gemma M0 guide!

To make it super easy, we'll be using CircuitPython, which comes pre-installed on the Gemma so no special IDE or compiler needed!

Many existing NeoPixel strand animations will work with this circuit, just change the data pin in the code to D1, and set the number of pixels in the strand to 5. I like the ombré rainbow animation in the Circuit Python NeoPixel sample code by Phillip Burgess.

Here's how I modified that sample code to just show the rainbow animation, which looks great when photographed:

I grabbed the code from the link above and pasted it into my code editor. Then I scrolled down to line 35 (see above). Lines 36 through 46 fill the strip with a single solid color, so I commented them out. Now the loop skips directly to the rainbow animation and plays that continuously. I saved this code onto my Gemma M0, and boom: rainbows for days! Well, more like an hour or so.

This animation is great for a photoshoot, where it's nice to have the LEDs lit constantly and predictably throughout the shoot. However, with such a tiny battery in this project, you'll get significantly more wear time if you build some kind of blinking action into your animation. So get creative here!

This guide was first published on Apr 11, 2018. It was last updated on Apr 11, 2018. This page (Program the Gemma M0) was last updated on Nov 19, 2019.