Code isn't running

Hello people who are reading this post! I'm sorry if this may be a duplicate but my code doesn't seem to run. I am using Mac book pro 13-inch 2019 with Mac OS Monterey 12.3.1. I am also running this code on the esp8266 and I'm currently trying to make friendship lamps following this tutorial: https://www.instructables.com/CoronaLamps-Simple-Friendship-Lamps-Anyone-Can-Mak/ I downloaded the code on the website and have modified it. It uploads perfectly fine without any errors except that it simply won't run anymore..

Things I've tried to do:

  • remove all the special symbols
  • make a simple version
  • restart application
  • restart computer
  • reset the esp8266
  • eat ice cream
  • fix the syntax

but it still wouldn't solve the problem. (and I barely know how to code..)

Here is the original code:

//import the libraries
#include <Adafruit_NeoPixel.h>
#include "config.h"

//define the Neopixel pin, this will be different then the pin we soldered the Neopixels to, as they are marked differently
#define PIN 5


//initialize the information for the Neopixels and Adafruit IO
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
AdafruitIO_Feed *lamp = io.feed("lamp");

//how long we want the lamps to stay on when activated (600,000 ms = 10 minutes)
const long interval = 600000;

//setup the timers and status for the lamp
unsigned long previousMillis = 0;
int tap = 0;

//set one of the lamps to 1, the other to 2
int lampVal = 2;

//the value that should activate the lamp. Don't mess with this, the code will figure out what this should be in the setup
int recVal = 0;



void setup() {

  //Start the serial monitor for debugging and status
  Serial.begin(9600);

  //figure out what recieved value should turn on the lamp (lampVal of other lamp)
  if (lampVal == 1) recVal = 2;
  if (lampVal == 2) recVal = 1;
  
  //Activate the Neopixels
  strip.begin();
  strip.setBrightness(255);
  strip.show(); // Initialize all pixels to 'off'

  //setup the touch sensor as a interrupt and input
  pinMode(12, INPUT);
  attachInterrupt(digitalPinToInterrupt(12), touch, CHANGE);
  
  //start connecting to Adafruit IO
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  //get the status of the value in Adafruit IO
  lamp->onMessage(handleMessage);

  //connect to Adafruit IO and play the "spin" Neopixel animation to show it's connecting until and connection is established
  while(io.status() < AIO_CONNECTED) {
    Serial.print(".");
    spin();
    delay(500);
  }

  //when a connection to Adafruit IO is made write the status in the Serial monitor and flash the Neopixels white
  Serial.println();
  Serial.println(io.statusText());
  flash();

  //get the status of our value in Adafruit IO
  lamp->get();
  
  
  previousMillis = millis();
}

void loop() {

  //keeps the ESP8266 connected to Adafruit IO
  io.run();

  //set the starting timer value
  unsigned long currentMillis = millis();

  //tap = 1 means that we have established that the other lamp was tapped
  if (tap == 1) {

    //check to see if the timer if over 10 minutes. If it is, turn off the Neopixels and reset the tap status
    if (currentMillis - previousMillis >= interval) {
      off();
      tap = 0;
    
    } else {

      //if the timer isn't over 10 minutes, continue playing the rainbow animation at a slow speed
      rainbow(200);
      
    }
    
  }
  
}


//the interrupt program that runs when the touch sensor is activated
ICACHE_RAM_ATTR void touch() {

  //while the touch sensor is activated, save the lampVal (either 1 or 2) to the Adafruit IO feed and turn the Neopixels to purple
  while (digitalRead(12) == 1) {

    lamp->save(lampVal);
    
      for(int i=0; i<strip.numPixels(); i++) {
        
      strip.setPixelColor(i, 102, 0, 204);
      
    }
    
    strip.show();

   //once the touch sensor isn't activated, send a 0 back to the Adafruit IO feed. 
  } if (digitalRead(12) == 0) {
    
      lamp->save(0);
      
      for(int i=0; i<strip.numPixels(); i++) {
        
      strip.setPixelColor(i, 0, 0, 0);
      
    }
    
    strip.show();
    
  }
  

  
}


//code that tells the ESP8266 what to do when it recieves new data from the Adafruit IO feed
void handleMessage(AdafruitIO_Data *data) {

  Serial.print("received <- ");

  //convert the recieved data to an INT
  int reading = data->toInt();

  //if the recieved value is equal to the recVal, and the lamp status is currently off, change the status to on and recent the timer
  if(reading == recVal && tap == 0) {
    
    Serial.println("TAP");
    previousMillis = millis();
    tap = 1;

  //if we recieve a value but the lamp is already on nothing happens
  } else {
    Serial.println("LOW");
  }

}

//simple code to turn all of the Neopixels off
void off() {
  
for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
    strip.show();
  
}


//The code that creates the gradual color change animation in the Neopixels (thank you to Adafruit for this!!)
void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}


//complicated geometry or something to figure out the color values (I don't know how this stuff works, thank goodness for adafruit)
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}


//code to flash the Neopixels when a stable connection to Adafruit IO is made
void flash() {

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);
}


//the code to create the blue spinning animation when connecting to Adafruit IO
void spin() {

  for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 255);
      strip.show();
      delay(20);
    }
    for(int i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, 0, 0, 0);
      strip.show();
      delay(20);
    }
  
}

Here's my code:

// โ•ฐโ”ˆโžค โ PART 1: Setting The Defaults

// โ’ importing the libraries
#include <WiFiManager.h>
#include <Adafruit_NeoPixel.h>
#include "config.h"

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Defining the pins
#define nLed 12 // โžค Number of leds
#define led 5 // โžค The neopixels
#define sensor 12 // โžค The touch sensor

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Lamp ID
int lampVal = 1; // โžค Change it

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Activation & color values
int recVals[] = {1, 2, 3, 4, 5};
int colorVals[3];
int glowVals[3];
int moreVals[3];

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Creating a neopixel object
Adafruit_NeoPixel strip = Adafruit_NeoPixel(nLed, led, NEO_GRB + NEO_KHZ800);

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Initialize Adafruit
AdafruitIO_Feed *lamp = io.feed("lamp");

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Set the activation time
const long interval = 600000; // โžค 600,000 ms = 10 min

//โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

// โ’ Setup timers & status
unsigned long previousMillis = 0;
int tap = 0;


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 2: The Setup Code

void setup() {
  
  // โ’ Start the serial monitor
  Serial.begin(9600);
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Figure out the activation values
  if (lampVal != 6) {
    for (int i = 0; i < 5; i = i + 1) {
      if (recVals[i] == lampVal) {
        recVals[i] = 6;
      }
    }
  }  
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Figure out the color values

  findColor(lampVal);
  
  colorVals[0] = moreVals[0];
  colorVals[1] = moreVals[1];
  colorVals[2] = moreVals[2];
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Activate the Neopixels
  strip.begin();
  strip.setBrightness(255);
  strip.show(); // โžค Initialize all pixels to off
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Setup touch sensor
  pinMode(sensor, INPUT);
  attachInterrupt(digitalPinToInterrupt(sensor), touch, CHANGE);
    
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Start connecting to Adafruit IO
  Serial.print("โœฐ Connecting to Adafruit IO โžค");
  io.connect();
    
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Get status of value in Adafruit IO
  lamp->onMessage(handleMessage);
    
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Connect to Adafruit IO
  while(io.status() < AIO_CONNECTED) {
    Serial.print(" โ˜’");
    spin();
    delay(500);
  }

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Get status when connected to Adafruit IO
  Serial.print(" โ˜‘");
  Serial.println();
  Serial.println("โ”€โ”€โ”€ โ‹†โ‹…โ˜†โ‹…โ‹† โ”€โ”€");
  Serial.println();
  Serial.println("โœฐ Status โžค ");
  Serial.print(io.statusText());
  flash();

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Get status of our value in Adafruit IO
  lamp->get();

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
  // โ’ Update timer
  previousMillis = millis();

}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 3: The Main Code

void loop() {

  // โ’ Keep connected to Adafruit
  io.run();

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Set the starting timer value
  unsigned long currentMillis = millis();
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Code when value has been handled
  if (tap != 0) { // โžค If another lamp is tapped

    if (currentMillis - previousMillis >= interval) { // โžค If the timer's over 10 minutes
      
      off();
      tap = 0; // โžค Reset the tap
      
    } else { // โžค If the timer isn't over 10 minutes

      glowVals[0] = moreVals[0];
      glowVals[1] = moreVals[1];
      glowVals[2] = moreVals[2];
      for(int i = 0; i < 3; i = i + 1) {
        strip.setPixelColor(i, glowVals[0], glowVals[1], glowVals[2]);
      }

    }
    
  }
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 4: When the touch sensor is activated

ICACHE_RAM_ATTR void touch() {

  // โ’ while the touch sensor is activated
  while (digitalRead(12) == 0) {

    lamp->save(lampVal);
    
      for(int i = 0; i < strip.numPixels() ; i = i + 1) {

        if ( (i % 2) == 0 ) {
          
          strip.setPixelColor(i, 102, 0, 204);
          
        } else {
          
          strip.setPixelColor(i, colorVals[0], colorVals[1], colorVals[2]);
          
        }
      
    }
    
    strip.show();

  } 
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Once the touch sensor isn't activated
  if (digitalRead(12) == 1) {
    
      lamp->save(0);
      off();
    
  }
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 5: When New Data has Been Recieved

void handleMessage(AdafruitIO_Data *data) {

  // โ’ Notify
  Serial.println();
  Serial.println("โ”€โ”€โ”€ โ‹†โ‹…โ˜†โ‹…โ‹† โ”€โ”€");
  Serial.println();
  Serial.println("โœฐ Notification โžค New data recieved");
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Convert the data to int
  int reading = data->toInt();
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

  // โ’ Check what lamp has been tapped

  for (int i = 0; i < 5; i = i + 1)
  if(reading == recVals[i] && tap == 0) {
    
    Serial.println();
    Serial.println("โ”€โ”€โ”€ โ‹†โ‹…โ˜†โ‹…โ‹† โ”€โ”€");
    Serial.println();
    Serial.println("โœฐ Notification โžค Lamp ");
    Serial.print(i);
    Serial.print(" has been tapped");
    
    previousMillis = millis();
    tap = 1;

  } else {
    
    Serial.println();
    Serial.println("โ”€โ”€โ”€ โ‹†โ‹…โ˜†โ‹…โ‹† โ”€โ”€");
    Serial.println();
    Serial.println("โœฐ Notification โžค Lamp ");
    Serial.print(i);
    Serial.print(" has been tapped but the lights are already on");
    
  }
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜

}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 6: Lights Off!

void off() {

  // โ’ Code to turn off lights
  for(int i=0; i<strip.numPixels(); i = i + 1) {
    strip.setPixelColor(i, 0, 0, 0);
  }
  
  strip.show();

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 7: What Color?

void findColor(int stuffedAnimals) {
  
  // โ’ Code to figure out the color values
  if (stuffedAnimals == 1) {
    moreVals[0] = 253;
    moreVals[1] = 1;
    moreVals[2] = 0;
  }
  if (stuffedAnimals == 2) {
    moreVals[0] = 247;
    moreVals[1] = 105;
    moreVals[2] = 25;
  }
  if (stuffedAnimals == 3) {
    moreVals[0] = 238;
    moreVals[1] = 222;
    moreVals[2] = 4;
  }
  if (stuffedAnimals == 4) {
    moreVals[0] = 160;
    moreVals[1] = 214;
    moreVals[2] = 54;
  }
  if (stuffedAnimals == 5) {
    moreVals[0] = 47;
    moreVals[1] = 162;
    moreVals[2] = 54;
  }
  if (stuffedAnimals == 6) {
    moreVals[0] = 51;
    moreVals[1] = 62;
    moreVals[2] = 212;
  }
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 8: Dizzy

void spin() {

  // โ’ Code to create the connecting animation
  for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, colorVals[0], colorVals[1], colorVals[2]);
      strip.show();
      delay(20);
    }
    for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0, 0, 0);
      strip.show();
      delay(20);
    }
    
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 9: Bling Bling

void flash() {

  // โ’ Code to flash the Neopixels
  for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 255, 255, 255);
    }
  strip.show();
  
  delay(200);

  for(int i=0; i<strip.numPixels(); i = i + 1) {
      strip.setPixelColor(i, 0, 0, 0);
    }
  strip.show();
  
  delay(200);
  
  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
}


// โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๏ฝฅ ๏ฝก๏พŸโ˜†: *.โ˜ฝ .* :โ˜†๏พŸ. โ”€โ”€โ”€โ”€โ”€โ”€โ”€


// โ•ฐโ”ˆโžค โ PART 10: Complicated Geometry

uint32_t Wheel(byte WheelPos) {

  // โ’ Code to figure out the real color values???
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

  //โˆ˜โ‚Šโœงโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โœงโ‚Šโˆ˜
  
}

Changes made:

  • Modified the code so it would work with 6 lamps
  • Changed a bit of the colours on the Adafruit Neopixels
  • Added some more status
  • Also renamed some of the variables
    You can check for more differences in diff checker

What the serial monitor displays:

20:27:36.744 -> โธฎโธฎโธฎโœฐ Connecting to Adafruit IO โžค*wm:[1] AutoConnect 
20:27:36.882 -> *wm:[2] Connecting as wifi client... 
20:27:36.916 -> *wm:[2] setSTAConfig static ip not set, skipping 
20:27:36.988 -> *wm:[1] Connecting to SAVED AP: Lamp
20:27:37.405 -> *wm:[1] connectTimeout not set, ESP waitForConnectResult... 
20:27:46.115 -> *wm:[2] Connection result: WL_NO_SSID_AVAIL
20:27:46.152 -> *wm:[1] AutoConnect: FAILED 
20:27:46.186 -> *wm:[2] Starting Config Portal 
20:27:46.221 -> *wm:[2] Disabling STA 
20:27:46.254 -> *wm:[2] Enabling AP 
20:27:46.254 -> *wm:[1] StartAP with SSID:  KLOK
20:27:46.687 -> *wm:[2] AP has anonymous access! 
20:27:47.201 -> *wm:[1] AP IP address: 192.168.4.1
20:27:47.235 -> *wm:[1] Starting Web Portal 
20:27:47.268 -> *wm:[2] HTTP server started 
20:27:47.305 -> *wm:[2] Config Portal Running, blocking, waiting for clients... 
20:28:06.795 -> *wm:[2] NUM CLIENTS:  0
20:28:36.776 -> *wm:[2] NUM CLIENTS:  0
20:29:06.789 -> *wm:[2] NUM CLIENTS:  0
20:29:36.775 -> *wm:[2] NUM CLIENTS:  0
20:30:06.773 -> *wm:[2] NUM CLIENTS:  0
20:30:36.775 -> *wm:[2] NUM CLIENTS:  0
20:31:06.775 -> *wm:[2] NUM CLIENTS:  0
20:31:36.778 -> *wm:[2] NUM CLIENTS:  0
20:32:06.789 -> *wm:[2] NUM CLIENTS:  0
20:32:40.012 -> *wm:[2] NUM CLIENTS:  0
20:33:07.609 -> *wm:[2] NUM CLIENTS:  0
20:33:37.876 -> *wm:[2] NUM CLIENTS:  0
20:34:08.768 -> *wm:[2] NUM CLIENTS:  0
20:34:36.768 -> *wm:[2] NUM CLIENTS:  0
20:35:06.799 -> *wm:[2] NUM CLIENTS:  0
20:35:37.506 -> *wm:[2] NUM CLIENTS:  0
20:36:09.502 -> *wm:[2] NUM CLIENTS:  0
20:36:36.795 -> *wm:[2] NUM CLIENTS:  0
20:37:07.136 -> *wm:[2] NUM CLIENTS:  0
20:37:36.833 -> *wm:[2] NUM CLIENTS:  0
20:38:06.880 -> *wm:[2] NUM CLIENTS:  0
20:38:43.096 -> *wm:[2] NUM CLIENTS:  0
20:39:09.076 -> *wm:[2] NUM CLIENTS:  0
20:39:36.778 -> *wm:[2] NUM CLIENTS:  0
20:40:07.937 -> *wm:[2] NUM CLIENTS:  0
20:40:36.823 -> *wm:[2] NUM CLIENTS:  0
20:41:09.358 -> *wm:[2] NUM CLIENTS:  0
20:41:39.096 -> *wm:[2] NUM CLIENTS:  0
20:42:08.744 -> *wm:[2] NUM CLIENTS:  0
20:42:43.122 -> *wm:[2] NUM CLIENTS:  0
20:43:11.434 -> *wm:[2] NUM CLIENTS:  0
20:43:41.791 -> *wm:[2] NUM CLIENTS:  0
20:44:08.409 -> *wm:[2] NUM CLIENTS:  0
20:44:43.173 -> *wm:[2] NUM CLIENTS:  0
20:45:10.658 -> *wm:[2] NUM CLIENTS:  0
20:45:42.989 -> *wm:[2] NUM CLIENTS:  0
20:46:06.793 -> *wm:[2] NUM CLIENTS:  0
20:46:36.797 -> *wm:[2] NUM CLIENTS:  0
20:47:06.803 -> *wm:[2] NUM CLIENTS:  0
20:47:36.809 -> *wm:[2] NUM CLIENTS:  0
20:48:06.794 -> *wm:[2] NUM CLIENTS:  0
20:48:36.800 -> *wm:[2] NUM CLIENTS:  0
20:49:06.787 -> *wm:[2] NUM CLIENTS:  0
20:49:36.792 -> *wm:[2] NUM CLIENTS:  0
20:50:06.955 -> *wm:[2] NUM CLIENTS:  0
20:50:37.952 -> *wm:[2] NUM CLIENTS:  0
20:51:06.961 -> *wm:[2] NUM CLIENTS:  0
20:51:53.578 -> *wm:[2] NUM CLIENTS:  0
20:52:13.308 -> *wm:[2] NUM CLIENTS:  0
20:52:41.984 -> *wm:[2] NUM CLIENTS:  0
20:53:12.934 -> *wm:[2] NUM CLIENTS:  0
20:53:41.803 -> *wm:[2] NUM CLIENTS:  0
20:54:06.803 -> *wm:[2] NUM CLIENTS:  0
20:54:36.794 -> *wm:[2] NUM CLIENTS:  0
20:55:09.575 -> *wm:[2] NUM CLIENTS:  0
20:55:39.194 -> *wm:[2] NUM CLIENTS:  0
20:56:07.033 -> *wm:[2] NUM CLIENTS:  0
20:56:36.987 -> *wm:[2] NUM CLIENTS:  0
20:57:08.689 -> *wm:[2] NUM CLIENTS:  0
20:57:37.539 -> *wm:[2] NUM CLIENTS:  0
20:58:09.096 -> *wm:[2] NUM CLIENTS:  0
20:58:40.688 -> *wm:[2] NUM CLIENTS:  0
20:59:10.862 -> *wm:[2] NUM CLIENTS:  0
20:59:41.006 -> *wm:[2] NUM CLIENTS:  0
21:00:11.677 -> *wm:[2] NUM CLIENTS:  0
21:00:41.925 -> *wm:[2] NUM CLIENTS:  0
21:01:08.146 -> *wm:[2] NUM CLIENTS:  0
21:01:37.850 -> *wm:[2] NUM CLIENTS:  0
21:02:07.828 -> *wm:[2] NUM CLIENTS:  0
21:02:36.801 -> *wm:[2] NUM CLIENTS:  0
21:03:06.817 -> *wm:[2] NUM CLIENTS:  0
21:03:36.824 -> *wm:[2] NUM CLIENTS:  0
21:04:06.801 -> *wm:[2] NUM CLIENTS:  0
21:04:38.505 -> *wm:[2] NUM CLIENTS:  0
21:05:09.228 -> *wm:[2] NUM CLIENTS:  0
21:05:39.963 -> *wm:[2] NUM CLIENTS:  0
21:06:09.943 -> *wm:[2] NUM CLIENTS:  0
21:06:37.070 -> *wm:[2] NUM CLIENTS:  0
21:07:07.118 -> *wm:[2] NUM CLIENTS:  0
21:07:37.491 -> *wm:[2] NUM CLIENTS:  0
21:08:08.420 -> *wm:[2] NUM CLIENTS:  0
21:08:43.174 -> *wm:[2] NUM CLIENTS:  0
21:09:15.122 -> *wm:[2] NUM CLIENTS:  0
21:09:37.152 -> *wm:[2] NUM CLIENTS:  0
21:10:06.897 -> *wm:[2] NUM CLIENTS:  0
21:10:36.912 -> *wm:[2] NUM CLIENTS:  0
21:11:06.909 -> *wm:[2] NUM CLIENTS:  0
21:11:36.905 -> *wm:[2] NUM CLIENTS:  0
21:12:06.896 -> *wm:[2] NUM CLIENTS:  0
21:12:36.909 -> *wm:[2] NUM CLIENTS:  0
21:13:06.907 -> *wm:[2] NUM CLIENTS:  0
21:13:36.903 -> *wm:[2] NUM CLIENTS:  0
21:14:06.901 -> *wm:[2] NUM CLIENTS:  0
21:14:36.920 -> *wm:[2] NUM CLIENTS:  0
21:15:06.898 -> *wm:[2] NUM CLIENTS:  0
21:15:36.927 -> *wm:[2] NUM CLIENTS:  0
21:16:06.911 -> *wm:[2] NUM CLIENTS:  0
21:16:36.933 -> *wm:[2] NUM CLIENTS:  0
21:17:06.915 -> *wm:[2] NUM CLIENTS:  0
21:17:36.922 -> *wm:[2] NUM CLIENTS:  0
21:18:06.922 -> *wm:[2] NUM CLIENTS:  0

What happens then? What error occurs when you open the serial monitor?

a7

Maybe ice cream wasn't enough!?

What problem?

Well if you modify the code. You have to know what the modification is doing.
The least thing you have to do as your own effort is

  • posting the original code as a code-section here in the arduino-forum
  • posting your modificated code
    and write a description where in the code you made modifications.

without that additional information you load a lot of unnescessary work on the shoulders of your potential helpers.

Now think about it what descision will your potential helpers make:

best regards Stefan

1 Like

The original code has some problems. In line 66 and line 263 they use "i = i++" in a 'for' loop. That expression produces UNDEFINED behavior and can do anything. Some of the more common correct ways to add 1 to 'i' are:

i = i + 1
i += 1
i++

After fixing the two loops and uploading the sketch to a "D1 mini" clone I got this output on Serial Monitor:

Connecting to Adafruit IO โžค โ˜’ โ˜’ โ˜’ โ˜’ โ˜’ โ˜‘
โ”€โ”€โ”€ โ‹†โ‹…โ˜†โ‹…โ‹† โ”€โ”€

โœฐ Status โžค 
Adafruit IO connected.
1 Like

It doesnโ€™t run for me either, so the code and hardware must be ok.

I ate two slices of ice cream cake but it still doesn't work...

too unserious. No longer tracking this thread

1 Like

The problem that the code won't run

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.