cant compiling below code whats wrong ?
/*
Virtual Ports:
V0 = Hue (Slider 0-255)
V1 = Saturation (Slider 0-255)
V2 = Brightness (Slider 0-255)
V3 = Cycle Pre-set (Momentary Button)
V4 = Colour: Blue (Momentary Button)
V5 = Updates Per Sec (Slider 1-500)
V6 = Colour: Red (Momentary Button)
V7 = Colour: Green (Momentary Button)
V8 = Colour: White (Momentary Button)
V9 = Terminal Widget
V10 = Manual Mode (Switch Button)
V11 = Sync gHUE (Momentary Button)
V12 = Colour: Yellow (Momentary Button)
V13 = Alert Mode (Momentary Button)
V14 = OFF (Momentary Button)
V15 = Colour: Light Blue (Momentary Button)
V16 = Shelf Up Time (Value Widget)
V17 = Shelf Wifi Signal (Value Widget)
V18 = Slave 1 Up Time (Value Widget)
V19 = Slave 1 Wifi Signal (Value Widget) optional
V20 = Slave 2 Up Time (Value Widget) optional
V21 = Slave 2 Wifi Signal (Value Widget) optional
V22 = Rainbow Mode Speed/Blend (Slider Widget range= -4 through +4
V29 = Night Mode
*/
/****************************************************************************/
#define BLYNK_PRINT Serial
#include <ArduinoOTA.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <FastLED.h>
#include <SimpleTimer.h>
//#include <WidgetRTC.h>
/**********************WEBSERVER UPLOAD************************************************/
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
#include <ESP8266WebServer.h>
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
/****************************************************************************/
#define BLYNK_MSG_LIMIT 200
#define DATA_PIN D6
/************************ CHANGE SETTINGS HERE ONLY *************************/
#define NUM_LEDS 150
char nickname[] = "LED1";
int HardwareZone = 2; // OUTDOOR // DONT USE 0 or 1 ... CAUSES ERRORS WITH LOGIC
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
/****************************************************************************/
int varHue;
int varHuePrev;
int varHueNew;
int varSaturation;
float varBrightness;
int varManualMode;
int varNextColour;
int varNextColourPrev;
int varBlendingMode;
int varUpdatesPerSec;
int varAlertMode;
int varZone;
int varRainbowSpeed;
long HexRGB;
int curMode;
int curSaturation;
int curBrightness;
int curHue;
int varBrightnessPrev;
boolean varManualModePrev;
boolean alarmToggle = 1;
boolean alarmTrigger = 0;
int alarmHue = 20;
int alarmSaturation = 200;
float alarmBrightness = 255.00000;
float timeOfFade = 60.00000;
boolean wakeUpModeON = false; //Blocks RGB Control during alarm !ONLY IN CODE NOT IN BLYNK-APP!
boolean wakeUpFirstStart = true; // Makes settings for first start wakeUpModeON.
float fadeStep = 0.00000;
boolean previewAlarm;
//WidgetRTC rtc;
//
//BLYNK_ATTACH_WIDGET(rtc, V24);
/****************************************************************************/
WidgetTerminal terminal(V9);
SimpleTimer timer;
SimpleTimer alarmTimer;
//SimpleTimer updateTimer;
int alarm1;
CRGB leds[NUM_LEDS];
/****************************************************************************/
void sendUptime() {
Blynk.virtualWrite(V16, millis() / 1000);
Blynk.virtualWrite(V17, map(WiFi.RSSI(), -105, -40, 0, 100) );
}
/****************************************************************************/
void setup()
{
WiFi.mode(WIFI_STA);
//Blynk.begin(auth, "xxxxxx", "xxxxxx", IPAddress(192, 168, 1, 2)); // my own local server
Blynk.begin(auth, "xxxxxxxxx", "xxxxxxx", "RASPBERRYPI");
while (Blynk.connect() == false) {}
/*********** OTA *************/
ArduinoOTA.setHostname("ESP-LED-01");
ArduinoOTA.begin();
/*********** OTA uploader webserver *************/
MDNS.begin("ESP-LED-01");
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
/******** BOOT VARS **********/
varHue = 190; // Start on a Blue Hue
varSaturation = 255; // Start Full Colour
varBrightness = 255; // Start Full Brightness
varManualMode = 0; // Start in preset mode
varNextColour = 0; //
varNextColourPrev = 0; // Set Button State
varBlendingMode = 1; // Start LINEARBLEND
varUpdatesPerSec = 128; // Start on 100 fps
varAlertMode = 0; // Start Alert Mode OFF
varZone = 1;
varRainbowSpeed = 0; // Start stationary
/******** FASTLED ************/
FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
/******** READY **************/
terminal.print(F("# Blynk v" BLYNK_VERSION ": "));
terminal.print(nickname);
terminal.println(F(" Device started"));
terminal.flush();
timer.setInterval(1000L, sendUptime);
Blynk.syncAll();
// rtc.begin();
}
/****************************************************************************/
// List of patterns to cycle through. Each is defined as a separate function below.
typedef void (*SimplePatternList[])();
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle };
uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
/****************************************************************************/
BLYNK_WRITE(V0) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varHue = param.asInt();
//HexRGB = ((long)leds[0].r << 16) | ((long)leds[0].g << 8 ) | (long)leds[0].b;
//Blynk.setProperty(V0, "color", "#" + String(HexRGB, HEX));
}
}
BLYNK_WRITE(V1) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varSaturation = param.asInt();
}
}
BLYNK_WRITE(V2) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varBrightness = param.asInt();
}
}
BLYNK_WRITE(V3) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varNextColour = param.asInt();
if (varNextColour == 1 && varNextColourPrev == 0) {
nextPattern();
delay(10);
}
varNextColourPrev = varNextColour;
}
}
BLYNK_WRITE(V4) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varHue = (int)152;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V0, 152);
delay(10);
}
}
BLYNK_WRITE(V5) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varUpdatesPerSec = param.asInt();
// varUpdatesPerSec = 1000 / varUpdatesPerSec;
}
}
BLYNK_WRITE(V6) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varHue = (int)0;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V0, 0);
delay(10);
}
}
BLYNK_WRITE(V7) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varHue = (int)80;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V0, 80);
delay(10);
}
}
BLYNK_WRITE(V8) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varSaturation = (int)0;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, 0);
delay(10);
}
}
BLYNK_WRITE(V10) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = param.asInt();
if (varManualMode == 1) {
previewAlarm = LOW;
Blynk.virtualWrite(35, LOW);
}
}
}
BLYNK_WRITE(V11) {
gHue = 0;
terminal.print(nickname);
terminal.println(" | Sync'd gHUE ");
terminal.flush();
}
BLYNK_WRITE(V15) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
Blynk.virtualWrite(V10, varManualMode);
varHue = (int)27;
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V0, 27);
delay(10);
}
}
BLYNK_WRITE(V12) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varHue = (int)64;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V0, 64);
delay(10);
}
}
BLYNK_WRITE(V13) {
varAlertMode = param.asInt();
terminal.print(nickname);
terminal.println(" | ALERT!");
terminal.flush();
}
BLYNK_WRITE(V14) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varManualMode = 1;
varBrightness = (int)0;
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V2, 0);
delay(10);
}
}
BLYNK_WRITE(V22) {
if ( (varZone == HardwareZone) || (varZone == 1)) {
varRainbowSpeed = param.asInt();
Blynk.virtualWrite(V22, varRainbowSpeed);
}
}
BLYNK_WRITE(V23) {
varZone = param.asInt();
if (varZone == HardwareZone) {
terminal.print(nickname);
terminal.println(" | Zone Selected!");
terminal.flush();
Blynk.virtualWrite(V0, varHue);
Blynk.virtualWrite(V1, varSaturation);
Blynk.virtualWrite(V2, varBrightness);
Blynk.virtualWrite(V5, varUpdatesPerSec);
Blynk.virtualWrite(V10, varManualMode);
Blynk.virtualWrite(V22, varRainbowSpeed);
}
}
BLYNK_WRITE(V28) {
alarmTrigger = param.asInt();
alarmMode();
}
BLYNK_WRITE(V27) {
alarmTrigger = param.asInt();
alarmMode();
}
BLYNK_WRITE(V30) {
alarmToggle = param.asInt();
if (alarmToggle == LOW || alarmTrigger == LOW) {
wakeUpFirstStart = true;
wakeUpModeON = false;
alarmTimer.deleteTimer(alarm1);
}
}
BLYNK_WRITE(V31) {
alarmHue = param.asInt();
}
BLYNK_WRITE(V36) {
alarmSaturation = param.asInt();
}
BLYNK_WRITE(V33) {
alarmBrightness = param.asInt();
if (previewAlarm == HIGH) {
varBrightness = alarmBrightness;
Blynk.virtualWrite(2, alarmBrightness);
}
}
BLYNK_WRITE(V34) {
timeOfFade = param.asInt() * 60; // Writes time of fade to seconds
terminal.print("timeOfFade: ");
terminal.println(timeOfFade);
terminal.flush();
}
BLYNK_WRITE(V35) {
previewAlarm = param.asInt();
if (previewAlarm == HIGH) {
varManualModePrev = varManualMode;
varBrightnessPrev = varBrightness;
varBrightness = alarmBrightness;
varManualMode = false;
Blynk.virtualWrite(10, varManualMode);
}
if (previewAlarm == LOW) {
varManualMode = varManualModePrev;
varBrightness = varBrightnessPrev;
Blynk.virtualWrite(10, varManualMode);
}
}
/****************************************************************************/
void alarmMode(){
if (alarmToggle == HIGH && alarmTrigger == HIGH) {
varBrightness = (int)0;
Blynk.virtualWrite(V2, varBrightness);
wakeUpModeON = true;
wakeUpMode();
}
if (alarmTrigger == LOW || alarmToggle == LOW) {
wakeUpFirstStart = true;
wakeUpModeON = false;
alarmTimer.deleteTimer(alarm1);
}
}
// TimeInputParam t(param);
//
// if (t.hasStartTime()) {
// alarmTrigger == HIGH;
// if (alarmToggle == HIGH && alarmTrigger == HIGH) {
// varBrightness = (int)0;
// Blynk.virtualWrite(V2, varBrightness);
// wakeUpModeON = true;
// wakeUpMode();
// }
// }
// if (t.hasStopTime()) {
// alarmTrigger == LOW;
// if (alarmTrigger == LOW || alarmToggle == LOW) {
// wakeUpFirstStart = true;
// wakeUpModeON = false;
// alarmTimer.deleteTimer(alarm1);
// }
// }
//}
void wakeUpMode() {
if (wakeUpModeON = true) {
varManualMode = LOW;
Blynk.virtualWrite(10, varManualMode);
if (wakeUpFirstStart == true) {
fadeStep = alarmBrightness / timeOfFade;
terminal.print("fadeStep: ");
terminal.print(fadeStep);
wakeUpFirstStart = false;
int alarm1 = alarmTimer.setTimer(1000, alarmFader, timeOfFade);
alarmTimer.enable(alarm1);
}
}
}
//FADING
void alarmFader() {
varBrightness += fadeStep;
Blynk.virtualWrite(V2, varBrightness);
terminal.flush();
}
//void updatePerSec() {
// gPatterns[gCurrentPatternNumber]();
// FastLED.show();
// EVERY_N_MILLISECONDS( 20 ) {
// gHue++; // slowly cycle the "base color" through the rainbow
// }
//FastLED.show();
//}
/****************************************************************************/
void loop()
{
Blynk.run();
ArduinoOTA.handle();
httpServer.handleClient();
timer.run(); // Initiates SimpleTimer
alarmTimer.run();
// updateTimer.run();
if (varAlertMode == 1) {
for (int i = 0; i < 20; i++) {
fill_solid(leds, NUM_LEDS, CRGB::White);
FastLED.show();
FastLED.delay(50);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
FastLED.delay(50);
}
varAlertMode = 0;
}
if (varManualMode == 1 && (alarmTrigger == LOW || alarmToggle == LOW)) { // Manual Control
fill_solid(leds, NUM_LEDS, CHSV(varHue, varSaturation, varBrightness));
FastLED.show();
}
if (varManualMode == 0 && ((alarmTrigger == HIGH && alarmToggle == HIGH) || previewAlarm == HIGH)) { // Manual Control
fill_solid(leds, NUM_LEDS, CHSV(alarmHue, alarmSaturation, varBrightness));
FastLED.show();
}
if (varManualMode == 0 && (alarmTrigger == LOW && alarmToggle == LOW) && previewAlarm == LOW) { // Pallette Mode
gPatterns[gCurrentPatternNumber]();
FastLED.show();
// updateTimer.setInterval(varUpdatesPerSec, updatePerSec);
FastLED.delay(1000 / varUpdatesPerSec);
EVERY_N_MILLISECONDS( 20 ) {
gHue++; // slowly cycle the "base color" through the rainbow
}
}
FastLED.show();
}
/****************************************************************************/
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
void nextPattern() {
// add one to the current pattern number, and wrap around at the end
gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
}
void rainbow() {
// FastLED's built-in rainbow generator
fill_rainbow( leds, NUM_LEDS, gHue, varRainbowSpeed);
}
void rainbowWithGlitter() {
// built-in FastLED rainbow, plus some random sparkly glitter
rainbow();
addGlitter(80);
}
void addGlitter( fract8 chanceOfGlitter) {
if ( random8() < chanceOfGlitter) {
leds[ random16(NUM_LEDS) ] += CRGB::White;
}
}
void confetti() {
// random colored speckles that blink in and fade smoothly
fadeToBlackBy( leds, NUM_LEDS, 10);
int pos = random16(NUM_LEDS);
leds[pos] += CHSV( gHue + random8(64), varSaturation, varBrightness);
}
void sinelon() {
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, NUM_LEDS, 20);
int pos = beatsin16(13, 0, NUM_LEDS);
leds[pos] += CHSV( gHue, varSaturation, varBrightness);
}
void juggle() {
// eight colored dots, weaving in and out of sync with each other
fadeToBlackBy( leds, NUM_LEDS, 20);
byte dothue = 0;
for ( int i = 0; i < 8; i++) {
leds[beatsin16(i + 7, 0, NUM_LEDS)] |= CHSV(dothue, varSaturation, varBrightness);
dothue += 32;
}
}
error code in arduino:
Arduino: 1.8.3 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
In file included from C:\Users\STRIX\Documents\Arduino\sketch_aug08a\sketch_aug08a.ino:33:0:
C:\Program Files (x86)\Arduino\libraries\FastLED-master/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.005
# pragma message "FastLED version 3.001.005"
^
In file included from C:\Program Files (x86)\Arduino\libraries\FastLED-master/FastLED.h:65:0,
from C:\Users\STRIX\Documents\Arduino\sketch_aug08a\sketch_aug08a.ino:33:
C:\Program Files (x86)\Arduino\libraries\FastLED-master/fastspi.h:110:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output
# pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
^
In file included from C:\Program Files (x86)\Arduino\libraries\FastLED-master/FastLED.h:48:0,
from C:\Users\STRIX\Documents\Arduino\sketch_aug08a\sketch_aug08a.ino:33:
C:\Program Files (x86)\Arduino\libraries\FastLED-master/fastpin.h: In instantiation of 'class FastPin<12u>':
C:\Program Files (x86)\Arduino\libraries\FastLED-master/platforms/esp/8266/clockless_esp8266.h:21:49: required from 'class ClocklessController<12, 26, 26, 52, (EOrder)66u, 0, false, 5>'
C:\Program Files (x86)\Arduino\libraries\FastLED-master/chipsets.h:460:7: required from 'class WS2811Controller800Khz<12u, (EOrder)66u>'
C:\Program Files (x86)\Arduino\libraries\FastLED-master/FastLED.h:107:52: required from 'class WS2811<12u, (EOrder)66u>'
C:\Program Files (x86)\Arduino\libraries\FastLED-master/FastLED.h:294:39: required from 'static CLEDController& CFastLED::addLeds(CRGB*, int, int) [with CHIPSET = WS2811; unsigned char DATA_PIN = 12u; EOrder RGB_ORDER = (EOrder)66u]'
C:\Users\STRIX\Documents\Arduino\sketch_aug08a\sketch_aug08a.ino:112:56: required from here
C:\Program Files (x86)\Arduino\libraries\FastLED-master/fastpin.h:206:2: error: static assertion failed: Invalid pin specified
static_assert(validpin(), "Invalid pin specified");
^
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.