Arduino Sketch

Installing Software Tools

Arduino IDE

You'll need Arduino version 1.6.5 or later installed.

Download Here

Teensyduino

To compile a sketch for the Teensy 3, you need an add-on for the Arduino IDE called Teensyduino. Download the latest version of Teensyduino for compatibility with the SmartMatrix Library.

Download Here

SmartMatrix Library

The latest version of the SmartMatrix is available on the project's GitHub Releases page. Download the latest SmartMatrix Library release and install it, using this guide as a reference if needed.

Download Here

Compiling

The AnimatedGIFs sketch is an example included with the SmartMatrix Library. It can be found under File, Examples, SmartMatrix, AnimatedGIFs

Note that if you used the Arduino Library Manager to install the SmartMatrix Library (instead of following the above instructions), the AnimatedGIFs example won't be included, as that sketch is included as a Git Submodule which is not supported by Arduino Library Manager. You will need to download the AnimatedGIFs example separately here

Under Tools, choose the settings you need for this Sketch:

  • Board: Teensy 3.2, 3.5, 3.6 depending on what you chose

  • CPU Speed: Choose the highest speed available without overclocking; decoding the GIFs is CPU intensive!  (Overclocked speeds may work too if you want to try them)

Edit the example sketch with the specifics of your SmartMatrix Shield, and LED matrix

Find the line with #include .  If you have a SmartLED Shield V4, make sure this line is uncommented (remove any // slashes before the #include).  If you are using a different shield, make sure the comments are there.

Find the section with this code:

#define SD_CS 15

//#define SD_CS BUILTIN_SDCARD

  • If you're using a Teensy 3.5/3.6, you want to uncomment the line with `BUILTIN_SDCARD`, and comment out the other line
  • If you're using a Teensy 3.2, or wired up your SD card externally, make sure `SD_CS ` is set to the pin you used for chip select - most likely pin 15.

Set kMatrixWidth, kMatrixHeight to the width and height of your display.

Set kPanelType according to the type of panel you are using. 

  • 16x32: kPanelType = SMARTMATRIX_HUB75_16ROW_MOD8SCAN
  • 32x32 or 64x32: kPanelType = SMARTMATRIX_HUB75_32ROW_MOD16SCAN
  • 64x64: kPanelType = SMARTMATRIX_HUB75_64ROW_MOD32SCAN

The Sketch is ready to compile and upload.  Connect the Teensy 3 via USB to your computer, plug in power to the SmartMatrix Shield, and press Upload.  When the Arduino IDE is done compiling, it calls a second program called Teensy Loader to do the uploading. You may need to press the button on your Teensy 3 to start the upload.

The sketch will run but display an error message as there is no SD card installed at this point. You can remove power from the SmartMatrix Shield while you load GIFs onto the microSD card.

This guide was first published on Oct 16, 2014. It was last updated on Oct 16, 2014. This page (Arduino Sketch) was last updated on Aug 18, 2019.