Arduino Code

Open OPCstreamSD from the Arduino folder and upload it to the board. 

This code tells the Feather to scan the root directory of your SD card for any file ending in “.opc”. These files will be generated by our Processing code (in a moment) using video files (MPEG, AVI, etc.) you provide.

This sketch won’t do anything useful yet, since we haven’t assembled the gauntlets, but it’s handy to have it pre-loaded on the M0 board so it’s ready for testing when the time comes.

Processing Code

We'll need to make a few minimal changes to the Processing code before we start creating our files.

Open the OPCvideoSplitFiles sketch in Processing. This code will split the video into a top half and a bottom half so you can play one video file that will be split between two gauntlets.

If you're making just one gauntlet, or if you want the same animation running on both, comment out the second OPC instance:

OPC    opc[]        = { new OPC(this, 30, "foldername/left/L01.opc"),
                        new OPC(this, 30, "foldername/right/R01.opc") };

Change the filepaths to point to some dedicated folders on your hard drive, and the filenames to something descriptive.  

Find these lines of code and update them to reflect the planned width and height of your LED matrix:

int    arrayWidth  = 16, // Width of LED matrix
       arrayHeight =  5, // Height of LED matrix

Then, click the "run" button and choose a video file.  The Processing script will convert the file you choose into an .opc file and save it to the path you've specified. 

Copy the files onto an SD card.  Don't use subfolders -- the server code is looking right at the root of the card.

Pop the card out of your computer and into your Feather, power it up and make sure you get some blinky lights happening on your test strip.

This guide was first published on Jun 05, 2016. It was last updated on May 15, 2016.

This page (Upload Code) was last updated on May 08, 2016.

Text editor powered by tinymce.