Mo Chen / Mbed 2 deprecated WS2812_Simple_Test

Dependencies:   PixelArray WS2812 mbed

Fork of WS2812_Example by Brian Daniels

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "WS2812.h"
00003 #include "PixelArray.h"
00004 
00005 #define WS2812_BUF 3
00006 #define NUM_COLORS 6
00007 #define NUM_LEDS_PER_COLOR 1
00008 
00009 PixelArray px(WS2812_BUF);
00010 
00011 // See the program page for information on the timing numbers
00012 // The given numbers are for the K64F
00013 WS2812 ws(D6, WS2812_BUF, 0, 5, 5, 0);
00014 
00015 int main()
00016 {
00017     px.Set(0, 0);
00018     px.Set(1, 0x00ff00);
00019     px.Set(2, 0x00ee00);
00020 
00021     // Now the buffer is written, rotate it
00022     // by writing it out with an increasing offset
00023     while (1) {
00024             ws.write(px.getBuf());
00025             wait(0.075);
00026     }
00027 
00028 }