I'm quite new to arduino and I keep running into a problem.
I get the following error message: 'rainbowCycle' was not declared in this scope
Below is my (compiled) code. Could you help me in figuring out where I am missing something? Thank you in advance.
#include <FastLED.h>
#define NUM_LEDS 9
#define DATA_PIN 4
#define LED_PIN 4
#define BRIGHTNESS 64
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
delay( 3000 ); // power-up safety delay
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
}
void loop() {
leds[0] = CRGB::Green;
FastLED.show();
delay(3000);
leds[1] = CRGB::Green;
FastLED.show();
delay(3000);
leds[2] = CRGB::Green;
FastLED.show();
delay(3000);
leds[3] = CRGB::Green;
FastLED.show();
delay(3000);
leds[4] = CRGB::Green;
FastLED.show();
delay(3000);
leds[5] = CRGB::Green;
FastLED.show();
delay(3000);
leds[6] = CRGB::Green;
FastLED.show();
delay(3000);
leds[7] = CRGB::Green;
FastLED.show();
delay(3000);
leds[8] = CRGB::Green;
FastLED.show();
delay(3000);
for (int i = 0; i < 9; i++) {
leds = CRGB::Green;
- FastLED.show();*
_ leds = CRGB::Black;_
* delay(100);*
* }*
{
* randomSeed(millis());*
* int wait=random(10,30);*
* int dim=random(4,6);*
* int max_cycles=8;
int cycles=random(1,max_cycles+1);
_ rainbowCycle(wait, cycles, dim);_
_}_
void rainbowCycle(int wait, int cycles, int dim) {
_ //loop several times with same configurations and same delay*_
* for(int cycle=0; cycle < cycles; cycle++){*
* byte dir=random(0,2);*
* int k=255;*
* //loop through all colors in the wheel*
* for (int j=0; j < 256; j++,k--) {*
* if(k<0) {*
* k=255;*
* }*
* //Set RGB color of each LED*
* for(int i=0; i<NUM_LEDS; i++) {
CRGB ledColor = wheel(((i * 256 / NUM_LEDS) + (dir==0?j:k)) % 256,dim);
_ leds=ledColor;
}
FastLED.show();
FastLED.delay(wait);
}
}
}
CRGB wheel(int WheelPos, int dim) {
CRGB color;
if (85 > WheelPos) {
color.r=0;
color.g=WheelPos * 3/dim;
color.b=(255 - WheelPos * 3)/dim;;
}
else if (170 > WheelPos) {
color.r=WheelPos * 3/dim;
color.g=(255 - WheelPos * 3)/dim;
color.b=0;
}
else {
color.r=(255 - WheelPos * 3)/dim;
color.g=0;
color.b=WheelPos * 3/dim;
}
return color;
}*_
}