Skip to content

FRC-Sonic-Squirrels/Blinkin-Firmware

 
 

Repository files navigation

REV Blinkin LED Driver

Getting Started

Important Note: Opening this device or using modified firmware may or may not change the legality for use in robotics competitions. Please refer to the rules of the specific competition you are using this device in before making modifications.

Important Note: Uploading custom code to the Blinkin requires opening the device. Please note that opening the device to upload code will void the warranty. REV Robotics is not liable for damage that may occur due to device modifications. Use at your own risk. For more details, please visit the REV Robotics Warranty Page.

Getting the board ready

This guide will use the programmer built into the Arduino Uno to target the Blinkin board. Be careful when following these instructions and wiring the device.

  • Follow the diagram below to carefully wire the Blinkin board into an Arduino Uno
  • Remove the main chip from the socket of the Arduino. This will cause the built-in Arduino programmer to target the Blinkin instead.
  • Apply 12V to the Blinkin with an XT30 cable
  • Plug the Arduino UNO into your computer with a USB-A to USB-B cable

Setting up the Arduino IDE

  • Download the Arduino IDE
  • Install and open the IDE
  • In the Tools tab, select "Arduino/Genuino Uno" under Board

  • Again in the Tools tab, select the port the Arduino is located at

Uploading the Blinkin firmware to the board

  • Clone or download Blinkin-Firmware-master.zip from this GitHub repository
  • Extract the contents into a folder named Blinkin-Firmware
  • Open Blinkin-Firmware.ino in the Arduino IDE
  • Download FastLED-master.zip and CircularBuffer-master.zip
  • Under Include Library, located in the Sketch tab, click "Add .ZIP Library..."

  • Locate FastLED-master.zip and CircularBuffer-master.zip and add both of them
  • Press the Upload button at the top of the IDE to load the firmware onto the board

Using the preset patterns

  • Plug an LED strip into the Blinkin with the Blinkin LED cable adapter to see the output
  • Hold the Mode button on the Blinkin board to enable setup mode
  • Use the Mode and Strip Select buttons to cycle through the preset patterns
  • Turn the left two potentiometers on the Blinkin to adjust the preset team colors (Used in patterns 49 through 79)
  • Turn the rightmost potentiometer to adjust the length of the LED strip
  • A list of the preset patterns can either be found in Blinkin-Firmware.ino or here

Editing the Firmware

Using the Serial Monitor

  • In Blinkin-Firmware.ino, add Serial.begin(115200); in setup()

  • Use Serial.print(); or Serial.println(); anywhere in the code to print to the Serial Monitor
  • Press the Serial Monitor button at the top right corner of the IDE to open the Serial Monitor

  • At the bottom right corner of the Serial Monitor, set the baud rate to 115200

Seeing what pattern you cycle to

  • Open UserIO.ino
  • Add Serial.println(noSignalPatternDisplay); at the locations in the screenshots below

Creating a custom function

  • In Blinkin-Firmware.ino, there is an array of functions named gPatterns
  • Change the name of an existing function in this list of functions

  • Then, to modify what it does, open the .ino file the function is located in (For this example, open PWM_1_Standard.ino)
  • Now find the function that was renamed, and change its name to the new one here
  • Inside the brackets next to the function is what runs when the function is selected
  • Delete the contents in the brackets and add a new method

  • Below, create the new method with the desired parameters and create what the function does inside the brackets
  • In this example, the method makes the LED strip blink rapidly between two colors, similar to the strobe function

Creating a custom palette

  • Locate the folder your Arduino libraries are saved in (usually C:\Users\Username\Documents\Arduino\libraries)
  • In FastLED-master, open colorpalettes.cpp and colorpalettes.h
  • Add the definition for the new color palette in colorpalettes.h by adding extern const TProgmemRGBPalette16 CustomPalette_p FL_PROGMEM;

  • Create the palette in colorpalettes.cpp by adding extern const TProgmemRGBPalette1 CustomPalette_p FL_PROGMEM = { };, putting the desired colors in the brackets
  • In this example, the palette cycles through white, red, blue, green, and yellow, then blacks out the LEDs before starting the cycle over

  • Save the two files and add the palettes into the Arduino code

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.0%
  • C 6.0%