/************************************************************** * Blynk is a platform with iOS and Android apps to control * Arduino, Raspberry Pi and the likes over the Internet. * You can easily build graphic interfaces for all your * projects by simply dragging and dropping widgets. * * Downloads, docs, tutorials: http://www.blynk.cc * Blynk community: http://community.blynk.cc * Social networks: http://www.fb.com/blynkapp * http://twitter.com/blynk_app * * Blynk library is licensed under MIT license * This example code is in public domain. * ************************************************************** * Control the IOT Ambilight Speaker. * Edited by PerfectPixel (www.instructables.com/member/perfectpixel * * For this example you need NeoPixel library: * https://github.com/adafruit/Adafruit_NeoPixel * You will also need any other libraries required for the internet interface you are choosing to use. * * App dashboard setup: * Large Slider Widget (0 - 500) on V1 called Color * Button Widget (push) on V2 called Cycle * Button Widget (push) on V3 called Rainbow * Button Widget (push) on V4 called Solid * Button Widget (push) on V5 called Off * Large Slider Widget (2-10) on V10 called Speed * **************************************************************/ #include //these libraries may be different if you are using a different interface (e.g. arduino wifi shield or the arduino ethernet shield #include #include int colordelay = 0; int shift = 0; #define PIN 3 //THE PIN THE NEOPIXEL's ARE CONNECTED TO int mode = 0; //1 = rainbow cycle, 2 = rainbow, 3 = solid color Adafruit_NeoPixel strip = Adafruit_NeoPixel(30, PIN, NEO_RGB + NEO_KHZ800); // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YOUR AUTH TOKEN HERE"; void setup(){ Blynk.begin(auth); strip.begin(); strip.show(); } BLYNK_WRITE(V2) { mode = 1; //RAINBOW CYCLE } BLYNK_WRITE(V3) { mode = 2; //RAINBOW } BLYNK_WRITE(V4) { mode = 3; //SOLID } BLYNK_WRITE(V5) { mode = 0; //OFF } BLYNK_WRITE(V1) { shift = param.asInt(); //Get the color from the slider } BLYNK_WRITE(V10) { colordelay = param.asInt(); //Get the speed from the slider } void loop() { Blynk.run(); if(mode == 0){ //activitating the off button will ovveride all other colors colorWipe(strip.Color(0, 0, 0), 1); } else if(mode == 3){ for (int i = 0; i < strip.numPixels(); i++) { strip.setPixelColor(i, Wheel(shift & 255)); // OR: strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + shift) & 255)); } strip.show(); } else if(mode == 2){ for(int j=0; j<256; j++) { for(int i=0; i