Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

DEPRECATED Example software for controlling a WS2812 RGB LED array via network

License

Notifications You must be signed in to change notification settings

ARMmbed/example-mbedos-ws2812-rgb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecation note!

Please note: This repository is deprecated and it is no longer actively maintained.

WS2812 RGB array example for FRDM-K64F

This repository contains example software for controlling a WS2812 RGB LED array via network.

Supported platforms:

How To

The following section explains how to build, flash and run the example on OS X, Linux and Windows.

Putting things together

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.

Changing the content of the RGB LED array remotely

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.

Development Pre-Requisites

Please install the following:

Build

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

Flash

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.

Run

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.

About

DEPRECATED Example software for controlling a WS2812 RGB LED array via network

Resources

License

Stars

Watchers

Forks

Packages

No packages published