initial upload
This commit is contained in:
parent
938aa0db71
commit
353cfe723c
22 changed files with 1582 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
|
||||
/*
|
||||
* Example of using the ChainableRGB library for controlling a Grove RGB.
|
||||
* This code cycles through all the colors in an uniform way. This is accomplished using a HSB color space.
|
||||
*/
|
||||
|
||||
|
||||
#include <ChainableLED.h>
|
||||
|
||||
#define NUM_LEDS 5
|
||||
|
||||
ChainableLED leds(7, 8, NUM_LEDS);
|
||||
|
||||
void setup()
|
||||
{
|
||||
leds.init();
|
||||
}
|
||||
|
||||
float hue = 0.0;
|
||||
boolean up = true;
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (byte i=0; i<NUM_LEDS; i++)
|
||||
leds.setColorHSB(i, hue, 1.0, 0.5);
|
||||
|
||||
delay(50);
|
||||
|
||||
if (up)
|
||||
hue+= 0.025;
|
||||
else
|
||||
hue-= 0.025;
|
||||
|
||||
if (hue>=1.0 && up)
|
||||
up = false;
|
||||
else if (hue<=0.0 && !up)
|
||||
up = true;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
|
||||
/*
|
||||
* Example of using the ChainableRGB library for controlling a Grove RGB.
|
||||
* This code fades in an out colors in a strip of leds.
|
||||
*/
|
||||
|
||||
|
||||
#include <ChainableLED.h>
|
||||
|
||||
#define NUM_LEDS 5
|
||||
|
||||
ChainableLED leds(7, 8, NUM_LEDS);
|
||||
|
||||
void setup()
|
||||
{
|
||||
leds.init();
|
||||
}
|
||||
|
||||
byte power = 0;
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (byte i=0; i<NUM_LEDS; i++)
|
||||
{
|
||||
if (i%2 == 0)
|
||||
leds.setColorRGB(i, power, 0, 0);
|
||||
else
|
||||
leds.setColorRGB(i, 0, 255-power, 0);
|
||||
}
|
||||
power+= 10;
|
||||
|
||||
delay(10);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
/*
|
||||
* Example of using the ChainableRGB library for controlling a Grove RGB.
|
||||
* This code puts a red dot (led) moving along a strip of blue dots.
|
||||
*/
|
||||
|
||||
#include <ChainableLED.h>
|
||||
|
||||
#define NUM_LEDS 5
|
||||
|
||||
ChainableLED leds(7, 8, NUM_LEDS);
|
||||
|
||||
void setup()
|
||||
{
|
||||
leds.init();
|
||||
}
|
||||
|
||||
byte pos = 0;
|
||||
|
||||
void loop()
|
||||
{
|
||||
for (byte i=0; i<NUM_LEDS; i++)
|
||||
{
|
||||
if (i==pos)
|
||||
leds.setColorRGB(i, 255, 0, 0);
|
||||
else
|
||||
leds.setColorRGB(i, 0, 0, 255);
|
||||
}
|
||||
delay(250);
|
||||
|
||||
pos = (pos+1) % NUM_LEDS;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue