Hey there everybody! This is my first time working with Arduino, and working with coding.... That being said, I found a couple of example sketches that I would like to combine and I'm really struggling trying to understand what is going wrong in my program. I feel as though it is almost compiled properly, but there is obviously a piece or two that I'm just not understanding. When I try to verify my sketch I'm being told that one of my components in the loop has not been declared in the scope, and I'm not sure where I am supposed to input the code to add the chase to be included in the void loop. If anybody could help me understand what I'm missing, it would be hugely appreciated!!
#include <Adafruit_NeoPixel.h>
#include <FastLED.h>
#define LED_PIN 6
#define DATA_PIN 6
#define LED_COUNT 124
#define NUM_LEDS 124
CRGB leds[NUM_LEDS];
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN);
void setup() {
// put your setup code here, to run once:
strip.begin();
strip.show();
strip.setBrightness(50);
Serial.begin(57600);
Serial.println("resetting");
LEDS.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
LEDS.setBrightness(84);
}
void fadeall() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i].nscale8(250);
}
}
void loop() {
// put your main code here, to run repeatedly:
theaterChaseRainbow(35);{
void theaterChaseRainbow(int wait) {
int firstPixelHue = 0; // First pixel starts at red (hue 0)
for (int a = 0; a < 30; a++) { // Repeat 30 times...
for (int b = 0; b < 3; b++) { // 'b' counts from 0 to 2...
strip.clear(); // Set all pixels in RAM to 0 (off)
// 'c' counts up from 'b' to end of strip in increments of 3...
for (int c = b; c < strip.numPixels(); c += 3) {
// hue of pixel 'c' is offset by an amount to make one full
// revolution of the color wheel (range 65536) along the length
// of the strip (strip.numPixels() steps):
int hue = firstPixelHue + c * 65536L / strip.numPixels();
uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
}
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
}
}
}
}
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for (int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for (int i = (NUM_LEDS) - 1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);\
}
}