37 lines
784 B
C++
37 lines
784 B
C++
/*
|
|
Grove LED Bar - Level Example
|
|
This example will show you how to use setLevel() function of this library.
|
|
The setLevel() function illuminates the given number of LEDs from either side.
|
|
|
|
Syntax setLevel(level)
|
|
0 = all LEDs off
|
|
5 = 5 LEDs on
|
|
10 = all LEDs on
|
|
|
|
Ported for MSP-EXP430F5529, TM4c123 (Tiva C) LaunchPad By Cameron P. LaFollette
|
|
*/
|
|
|
|
#include <Grove_LED_Bar.h>
|
|
|
|
|
|
// Arduino Clock pin, Data pin, Orientation
|
|
// Grove_LED_Bar bar(9, 8, 0); // Clock pin, Data pin, Orientation
|
|
|
|
// LaunchPad Clock pin, Data pin, Orientation
|
|
Grove_LED_Bar bar(35, 36, 0); // Clock pin, Data pin, Orientation
|
|
|
|
void setup()
|
|
{
|
|
// nothing to initialize
|
|
bar.begin();
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
// Walk through the levels
|
|
for (int i = 0; i <= 10; i++)
|
|
{
|
|
bar.setLevel(i);
|
|
delay(100);
|
|
}
|
|
}
|