Specific Pelion ready example using features of Seeed Wio boards including cellular and SD Card
Dependencies: WS2812 PixelArray
Fork of simple-mbed-cloud-example-wio_3g by
Wio_LED.h
00001 #include "WS2812.h" 00002 #include "PixelArray.h" 00003 00004 #define WS2812_BUF 8 00005 #define NUM_COLORS 8 00006 #define NUM_LEDS_PER_COLOR 8 00007 #define H0 8 00008 #define L0 32 00009 #define H1 17 00010 #define L1 32 00011 00012 enum ws2812_color { 00013 WS2812_BLACK = 0, 00014 WS2812_RED, 00015 WS2812_YELLOW, 00016 WS2812_GREEN, 00017 WS2812_CYAN, 00018 WS2812_BLUE, 00019 WS2812_PURPLE, 00020 WS2812_WHITE 00021 }; 00022 00023 static DigitalOut LEDPower(PE_8, 1); 00024 static PixelArray px(WS2812_BUF); 00025 static WS2812 ws(PB_1, WS2812_BUF, H0, L0, H1, L1); 00026 00027 static const int colorbuf[NUM_COLORS] = {0x000000, 0x2f0000,0x2f2f00,0x002f00,0x002f2f,0x00002f,0x2f002f, 0x2f2f2f}; 00028 00029 void setColor(ws2812_color color) 00030 { 00031 px.Set(0, colorbuf[color]); 00032 px.SetI(0, 0x80); 00033 ws.write_offsets(px.getBuf(), 0, 0, 0); 00034 } 00035
Generated on Tue Jul 12 2022 19:09:28 by
