Zac Dannelly
/
NeoPixelEasy
Program to demo the easyNeo class
main.cpp
- Committer:
- dannellyz
- Date:
- 2015-02-15
- Revision:
- 1:9a5fbfa38676
- Parent:
- 0:8b36d99af4c3
File content as of revision 1:9a5fbfa38676:
#include "mbed.h" //Include both of the following to use easyNeo class #include "neopixel.h" #include "easyNeo.h" //Innitialize easyNeo simple with the number of LEDs in the grouping easyNeo neoTest(3); int main() { //for easy adding: //red = FF0000 //green = 00FF00 //blue = 0000FF //off = 000000 while (1) { //Clear all data from LEDs to help reduce collisions neoTest.clear(); //Runs through a test of all lights and colors neoTest.lightTest(); wait(1); neoTest.clear(); //Coding example of how to set only the first //Light in a strand of three: //to red... neoTest.setByHex("FF0000000000000000"); wait(1); neoTest.clear(); //to blue.. neoTest.setByHex("0000000000FF000000"); wait(1); neoTest.clear(); //to green.. neoTest.setByHex("00000000000000FF00"); wait(1); neoTest.clear(); //To add additional lights add antoher set of 6 hex charatcers //corresponding to the desired setting. //Dont forgot to change delared class to add additional lights //Here are the above examples having the forth light mimic the color. /* easyNeo neoTest2(4); //to red... neoTest2.setByHex("FF0000000000000000FF0000"); wait(1); neoTest2.clear(); //to green.. neoTest2.setByHex("0000000000FF0000000000FF"); wait(1); neoTest2.clear(); //to blue.. neoTest2.setByHex("00000000000000FF0000FF00"); wait(1); neoTest.clear(); */ } }