#include #include #define PIN 6 Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800); TAH myTAH; void setup() { // initialize serial: Serial.begin(9600); myTAH.begin(9600); myTAH.enterCommandMode(); myTAH.setName("Mood Lamp"); myTAH.setWorkRole(SLAVE); myTAH.setAuth(OPEN); myTAH.setWorkMode(REMOTE_CONTROL); myTAH.setiBeaconMode(ON); myTAH.exitCommandMode(); strip.begin(); strip.show(); // Initialize all pixels to 'off' } void loop() { if (myTAH.available()) { int red = myTAH.parseInt(); // do it again: int green = myTAH.parseInt(); // do it again: int blue = myTAH.parseInt(); int pattern = myTAH.parseInt(); if(myTAH.read() == 'R') { if ( pattern == 1) { colorWipe(strip.Color(red, green,blue), 30); Serial.print(red); Serial.print(","); Serial.print(green); Serial.print(","); Serial.println(blue); } else if(pattern == 2) { //theaterChase(strip.Color(127, 127, 127), 50); // White //theaterChase(strip.Color(127, 0, 0), 50); // Red //theaterChase(strip.Color( 0, 0, 127), 50); // Blue rainbow(10); //rainbowCycle(20); //theaterChaseRainbow(50); } } } } // Neopixels Functions // Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i