Program to demo the easyNeo class

Dependencies:   easyNeo mbed

Committer:
dannellyz
Date:
Sun Feb 15 22:34:11 2015 +0000
Revision:
1:9a5fbfa38676
Parent:
0:8b36d99af4c3
round2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dannellyz 0:8b36d99af4c3 1 #include "mbed.h"
dannellyz 0:8b36d99af4c3 2 //Include both of the following to use easyNeo class
dannellyz 0:8b36d99af4c3 3 #include "neopixel.h"
dannellyz 0:8b36d99af4c3 4 #include "easyNeo.h"
dannellyz 0:8b36d99af4c3 5
dannellyz 0:8b36d99af4c3 6 //Innitialize easyNeo simple with the number of LEDs in the grouping
dannellyz 0:8b36d99af4c3 7 easyNeo neoTest(3);
dannellyz 0:8b36d99af4c3 8
dannellyz 0:8b36d99af4c3 9 int main()
dannellyz 0:8b36d99af4c3 10 {
dannellyz 0:8b36d99af4c3 11
dannellyz 0:8b36d99af4c3 12 //for easy adding:
dannellyz 0:8b36d99af4c3 13 //red = FF0000
dannellyz 0:8b36d99af4c3 14 //green = 00FF00
dannellyz 0:8b36d99af4c3 15 //blue = 0000FF
dannellyz 0:8b36d99af4c3 16 //off = 000000
dannellyz 1:9a5fbfa38676 17
dannellyz 0:8b36d99af4c3 18 while (1) {
dannellyz 1:9a5fbfa38676 19
dannellyz 1:9a5fbfa38676 20 //Clear all data from LEDs to help reduce collisions
dannellyz 0:8b36d99af4c3 21 neoTest.clear();
dannellyz 1:9a5fbfa38676 22 //Runs through a test of all lights and colors
dannellyz 0:8b36d99af4c3 23 neoTest.lightTest();
dannellyz 0:8b36d99af4c3 24 wait(1);
dannellyz 0:8b36d99af4c3 25 neoTest.clear();
dannellyz 1:9a5fbfa38676 26 //Coding example of how to set only the first
dannellyz 1:9a5fbfa38676 27 //Light in a strand of three:
dannellyz 1:9a5fbfa38676 28 //to red...
dannellyz 0:8b36d99af4c3 29 neoTest.setByHex("FF0000000000000000");
dannellyz 0:8b36d99af4c3 30 wait(1);
dannellyz 0:8b36d99af4c3 31 neoTest.clear();
dannellyz 1:9a5fbfa38676 32 //to blue..
dannellyz 0:8b36d99af4c3 33 neoTest.setByHex("0000000000FF000000");
dannellyz 0:8b36d99af4c3 34 wait(1);
dannellyz 0:8b36d99af4c3 35 neoTest.clear();
dannellyz 1:9a5fbfa38676 36 //to green..
dannellyz 0:8b36d99af4c3 37 neoTest.setByHex("00000000000000FF00");
dannellyz 0:8b36d99af4c3 38 wait(1);
dannellyz 0:8b36d99af4c3 39 neoTest.clear();
dannellyz 0:8b36d99af4c3 40
dannellyz 1:9a5fbfa38676 41 //To add additional lights add antoher set of 6 hex charatcers
dannellyz 1:9a5fbfa38676 42 //corresponding to the desired setting.
dannellyz 1:9a5fbfa38676 43 //Dont forgot to change delared class to add additional lights
dannellyz 1:9a5fbfa38676 44 //Here are the above examples having the forth light mimic the color.
dannellyz 1:9a5fbfa38676 45 /*
dannellyz 1:9a5fbfa38676 46 easyNeo neoTest2(4);
dannellyz 1:9a5fbfa38676 47 //to red...
dannellyz 1:9a5fbfa38676 48 neoTest2.setByHex("FF0000000000000000FF0000");
dannellyz 1:9a5fbfa38676 49 wait(1);
dannellyz 1:9a5fbfa38676 50 neoTest2.clear();
dannellyz 1:9a5fbfa38676 51 //to green..
dannellyz 1:9a5fbfa38676 52 neoTest2.setByHex("0000000000FF0000000000FF");
dannellyz 1:9a5fbfa38676 53 wait(1);
dannellyz 1:9a5fbfa38676 54 neoTest2.clear();
dannellyz 1:9a5fbfa38676 55 //to blue..
dannellyz 1:9a5fbfa38676 56 neoTest2.setByHex("00000000000000FF0000FF00");
dannellyz 1:9a5fbfa38676 57 wait(1);
dannellyz 1:9a5fbfa38676 58 neoTest.clear();
dannellyz 1:9a5fbfa38676 59 */
dannellyz 1:9a5fbfa38676 60
dannellyz 1:9a5fbfa38676 61
dannellyz 0:8b36d99af4c3 62
dannellyz 0:8b36d99af4c3 63 }
dannellyz 0:8b36d99af4c3 64 }