NeoPixel sample

Dependencies:   mbed NeoPixel

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers <title>main.cpp Source File</title>

main.cpp

00001 #include "mbed.h"
00002 #include "neopixel.h"
00003 
00004 
00005 NeoPixelOut neoPixel(p11);
00006 
00007 int main() {
00008     wait(0.2); // wait for HSE to stabilize
00009     
00010     neoPixel.global_scale = 1.0f; // Adjust brightness
00011     neoPixel.normalize = true; // Equalize brightness to make r + g + b = 255
00012     
00013     Pixel pixels[6];
00014     pixels[0].hex = 0xFF0000;
00015     pixels[1].hex = 0xFFFF00;
00016     pixels[2].hex = 0x00FF00;
00017     pixels[3].hex = 0x00FFFF;
00018     pixels[4].hex = 0x0000FF;
00019     pixels[5].hex = 0xFF00FF;
00020     
00021     neoPixel.send(pixels, 6);
00022     
00023     while(1);
00024 }