Please note: This repository is deprecated and it is no longer actively maintained.
This repository contains example software for controlling a WS2812 RGB LED array via network.
Supported platforms:
The following section explains how to build, flash and run the example on OS X, Linux and Windows.
In our example we use a NeoPixel NeoMatrix (alternatively a Nulsom Rainbox Matrix) and a Freescale FRDM-K64F development board. The example code supports all WS2182/WS2182B based RGB modules (zero-, one- and two-dimensional).
Wiring things up:
- connect RGB matrix data-input to the PTD2 pin on FRDM-K65F
- connect RGB matrix power to the FRDM-K65F 3v3 pin
- connect RGB matrix ground to a FRDM-K65F GND pin
you can find the full pinmap here.
Once you reset the device, it will get an IP address via UDP. The target UDP port of your device is 2342. You can find the boards IP-address on its serial console (115200 baud):
NET: UDP Server IP Address is 10.254.1.234:2342
NET: Waiting for packet...
using the tool netcat you can now send images to the array:
cat docs/smiley-happy.rgb | nc -u 10.254.1.234 2342
cat docs/smiley-sad.rgb | nc -u 10.254.1.234 2342
you will get the following indication of receiving these two updates on the serial console of the target device:
NET: rx[192]
NET: rx[192]
The transmitted file format is trivial - just sequence of RGB triplets with one byte per channel. The total file size is therefore WIDTH x HEIGHT x 3 bytes. You can easily convert your own 8x8 images using ImageMagick or GraphicsMagick:
convert docs/smiley-happy.png smiley-happy.rgb
The device will confirm each data reception over the network - and respond with its screen size and type:
{"type": "RAINBOW_MATRIX", "width": 8,"height": 8}
You can simply send a zero sized packet to detect the screen size o nthe other end.
Please install the following:
- yotta. Please note that yotta has its own set of dependencies, listed in the installation instructions.
First, download the sources and navigate to the directory containing your source files:
git clone https://github.com/ARMmbed/example-mbedos-ws2812-rgb.git
cd example-mbedos-ws2812-rgb
yotta must know which platform (target) it is building to. So we declare the target, then build.
yotta target frdm-k64f-gcc
yotta build -r
for subsequent builds you only need to run
yotta build -r
The resulting binary file will be located in
./build/frdm-k64f-gcc/source/example-mbedos-ws2812-rgb.bin
Connect your board to your computer USB port and simply drag & drop the binary file from the previous step into the MBED
device listed in the file browser.
Hit the reset button after flashing to start program execution. The application will be running right after you reset the processor. The red LED starts blinking with 100ms period.