Ingo Lohs
Published © GPL3+

Grove - Introduction to Chainable LED

This project shows how to connect a chainable LED to Grove.

BeginnerProtip1 hour1,905
Grove - Introduction to Chainable LED

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
Seeed Grove Base Shield
×1
Seeed Chainable LED
×1

Software apps and online services

Arduino Web Editor
Arduino Web Editor

Story

Read more

Code

Chainable LED

C/C++
Example Code from Seeedstudio
/* 
 * 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;
}

Credits

Ingo Lohs

Ingo Lohs

94 projects • 125 followers
I am well over 40 years and come from the middle of Germany.

Comments