Demo of NeoPixels using buffer/array of pixels method.

Dependencies:   PixelArrayBuffer mbed

Edit of Jacob Bramley's original NeoPixel Demo code. https://developer.mbed.org/users/JacobBramley/code/NeoPixel-Demo/ This code simply demos the buffer/array of pixels method in updating the NeoPixel chain. The original version of this code used the generator method.

Files at this revision

API Documentation at this revision

Comitter:
ben_ceron
Date:
Tue Mar 10 06:26:24 2015 +0000
Commit message:
Buffer method demo.

Changed in this revision

PixelArray.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PixelArray.lib	Tue Mar 10 06:26:24 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ben_ceron/code/PixelArrayBuffer/#df8daeaa3d87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 10 06:26:24 2015 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "neopixel.h"
+
+// This must be an SPI MOSI pin.
+#define DATA_PIN p5
+
+
+int main()
+{
+    
+
+    // Create a temporary DigitalIn so we can configure the pull-down resistor.
+    // (The mbed API doesn't provide any other way to do this.)
+    // An alternative is to connect an external pull-down resistor.
+    DigitalIn(DATA_PIN, PullDown);
+
+    // The pixel array control class.
+    neopixel::PixelArray array(DATA_PIN);
+    // Declare array/buffer of type Pixel.
+    uint16_t numPixels = 4;
+    neopixel::Pixel pixels[numPixels];
+    // Use buffer method of updating pixels.
+    pixels[0].red = 255;
+    pixels[0].green = 0;
+    pixels[0].blue = 0;
+    pixels[1].red = 255;
+    pixels[1].green = 140;
+    pixels[1].blue = 0;
+    pixels[2].red = 0;
+    pixels[2].green = 255;
+    pixels[2].blue = 0;
+    pixels[3].red = 0;
+    pixels[3].green = 0;
+    pixels[3].blue = 255;
+    while (1) {
+        array.update(pixels, numPixels);
+        
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 10 06:26:24 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf
\ No newline at end of file