Software Setup

If this is your first time using Pro Trinket, take a look at Introducting Pro Trinket to get a guided tour.   

Once you've got your Pro Trinket up and running with Arduino, you'll need to install the FastLED library.

FastLED Library

You will also need to install the FastLED library in Arduino (Sketch > Include Library > Manage Libraries...)

Libraries? Why? What's a Library?

In a nutshell, Arduino libraries have a lot of pre-written functions that make your neopixels easy to command.  You can do fancy stuff without being a code guru. Yay Libraries!

FastLED is a fast, efficient, easy-to-use Arduino library for programming addressable LED strips and pixels.  It has a lot of features to get your animations up and running fast -- and it has a lot of code samples available if you're just learning to code.

All about Arduino Libraries will tell you everything you ever wanted to know about libraries, including more detailed installation instructions.

Once your curiosity is satiated and your library is installed, copy and paste the code into your Arduino window.

Go to your Tools menu and select "Pro Trinket 5V USB" from the list of boards.  Plug your Pro Trinket into your computer via the onboard USB port.  Press the "reset" button on your Pro Trinket and wait for the blinky red light, then click the upload button in Arduino.

#include <FastLED.h>

#define LED_PIN     3
#define NUM_LEDS    16          //change this to reflect the number of neopixels in your boots

#define SENSOR_LOW  35          //these numbers will change the sensitivity of the sensor.  Lower numbers = harder step to trigger
#define SENSOR_HIGH  65   

CRGBPalette16 currentPalette;
TBlendType    currentBlending;

uint8_t thishue = 0;
uint8_t deltahue = -3;     //controls how quickly the rainbow fades from one color to another. Negative numbers make the rainbow 
                           //  aapear to crawl "down" and positive numbers make it crawl "up"

const int STEP_PIN = A5;  // Analog input pin that the force sensitive resistor is attached to
int sensorValue = 0;        // value read from the pot
int ledMode = 0;  

void setup() {
  // initialize serial communications at 9600 bps:
 FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );


void loop() {
  // read the analog in value:
  sensorValue = analogRead(STEP_PIN);              
  // print the results to the serial monitor:
 Serial.print("sensor = " );                       

    switch (ledMode) {
       case 999: break;
       case 0: rainbow(); break;           //mode that's running all the time            
       case 1: fire(); break;             //mode that runs when sensor is triggered               
  if (sensorValue < SENSOR_LOW){
  Serial.println("leds triggered"); 
if (sensorValue > SENSOR_HIGH){
  Serial.println("leds not triggered"); 



void rainbow()
 thishue = thishue + 1;
 fill_rainbow(leds, NUM_LEDS, thishue, deltahue);;
 FastLED.delay(100);                       //change delay number to speed up or slow down the animation

//FIRE EFFECT by Mark Kriegsman

void fire()
  currentPalette = LavaColors_p;  
  Fire2012WithPalette(); // run simulation frame, using palette colors; // display this frame

#define COOLING  55  // Less cooling = taller flames. Default 55, suggested range 20-100
#define SPARKING 120 //Higher chance = more roaring fire.  Default 120, suggested range 50-200

void Fire2012WithPalette()
  random16_add_entropy( random());
  static byte heat[NUM_LEDS];
    for( int i = 0; i < NUM_LEDS; i++) {
      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
    for( int k= NUM_LEDS - 3; k > 0; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    if( random8() < SPARKING ) {
      int y = random8(7);
      heat[y] = qadd8( heat[y], random8(160,255) );
    for( int j = 0; j < NUM_LEDS; j++) {
      byte colorindex = scale8( heat[j], 240);
      leds[ (NUM_LEDS-1) - j ] = ColorFromPalette( currentPalette, colorindex);  //upside down fire!!  reverse it: leds[j] = ...

Plug in your LiPo battery and the boots will come on in Rainbow mode.  Step or press down on the sensor in the boot heel, and they will switch to Fire mode.

You may need to tweak the SENSOR_HIGH and SENSOR_LOW numbers until you have a satisfying rainbow-to-fire ratio.

If you encounter trouble…

Any time you hit a roadblock with a neopixel project, we’ll usually ask that you start with the “strandtest” example from our own Adafruit_NeoPixel library. This helps us narrow down whether it’s a hardware or software issue. The library is installed similarly to FastLED or any other in Arduino (Sketch > Include Library > Manage Libraries...)

You’ll find the strandtest example under File→Sketchbook→Libraries→Adafruit_NeoPixel→strandtest

If strandtest fails to run, this suggests a hardware issue…for example, connecting to the wrong Gemma pin.

If you’re new to Arduino programming and LEDs, we usually suggest starting with the Adafruit_NeoPixel library…it’s pretty basic, the strip declaration is more conventional, and we can stay on top of keeping it compatible with our own products and the most mainstream Arduino boards.

As FastLED is a more “bleeding edge” third-party library, we can’t always guarantee compatibility across versions or with specific boards. You can find help through their community on Google+. This is potent stuff, written by people with a deep appreciation for LED art, and we wanted to showcase it.

This guide was first published on Mar 01, 2015. It was last updated on Mar 01, 2015.

This page (The Code) was last updated on Feb 17, 2015.

Text editor powered by tinymce.