This is a Shield Bot Library

Embed: (wiki syntax)

« Back to documentation index

ColorPixels Class Reference

ColorPixels Class Reference

Color pixels class using WS2812B and nRF51822 (16Hz) More...

#include <ShieldBot_v12.h>

Public Member Functions

 ColorPixels (uint8_t pin, uint16_t num)
 Initilaze.
void set_color (uint16_t index, uint8_t r, uint8_t g, uint8_t b)
 Set the color of a pixel (without update)
void update ()
 Update.
void clear ()
 Turn off all pixels.

Detailed Description

Color pixels class using WS2812B and nRF51822 (16Hz)

Example:

 #include "mbed.h"
 #include "color_pixels.h"

 ColorPixels pixels(1, 32);

 int main() {
    pixels.set_color(0, 0, 255, 0);
    pixels.update();

    while(1) {
    }
 }

Definition at line 62 of file ShieldBot_v12.h.


Constructor & Destructor Documentation

ColorPixels ( uint8_t  pin,
uint16_t  num 
)

Initilaze.

Parameters:
pinnumber of GPIO
numnumber of pixels

Definition at line 123 of file ShieldBot_v12.cpp.


Member Function Documentation

void clear (  )

Turn off all pixels.

Definition at line 193 of file ShieldBot_v12.cpp.

void set_color ( uint16_t  index,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Set the color of a pixel (without update)

Parameters:
indexindex of a pixel
rred
ggreen
bblue

Definition at line 147 of file ShieldBot_v12.cpp.

void update (  )

Update.

Definition at line 172 of file ShieldBot_v12.cpp.