initial upload
This commit is contained in:
parent
5e15ec6488
commit
c39e10b2e7
61 changed files with 2296 additions and 0 deletions
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Grove LED Bar - Bounce Example
|
||||
This example will show you how to use getBits() function of this library.
|
||||
The getBits() function returns the current state so you can modify it.
|
||||
Use the setBits() function to save the new state.
|
||||
|
||||
Ported to MSP-EXP430F5529, and TM4C123 (Tiva C) by Cameron P. LaFollette
|
||||
|
||||
*/
|
||||
|
||||
#include <Grove_LED_Bar.h>
|
||||
|
||||
// Arduino Clock pin, Data pin, Orientation
|
||||
// Grove_LED_Bar bar(7, 6, 0);
|
||||
|
||||
// LaunchPad Clock pin, Data pin, Orientation
|
||||
Grove_LED_Bar bar(35, 36, 0); // Clock pin, Data pin, Orientation
|
||||
|
||||
unsigned int state;
|
||||
|
||||
void setup()
|
||||
{
|
||||
// nothing to initialize
|
||||
bar.begin();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Switch on the first two LEDs
|
||||
bar.setLevel(2);
|
||||
|
||||
// Get the current state (which is 0x3)
|
||||
state = bar.getBits();
|
||||
|
||||
// Bounce to the right
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
// Bit shift left and update
|
||||
state <<= 1;
|
||||
bar.setBits(state);
|
||||
delay(200);
|
||||
}
|
||||
|
||||
// Bounce to the left
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
// Bit shift right and update
|
||||
state >>= 1;
|
||||
bar.setBits(state);
|
||||
delay(200);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue