Beste forum lezer,
Heb een aantal progjes gemaakt met Oled, snelheidmeter, NL verkeerslicht met nachtstand maar met het volgende komt ik niet uit.
Op Tweaking4all alle verschillende effecten voor neopixel gekopieerd en getest op 1 ring.
Nu doe ik aan modelbouw en heb een kermis, met 5 verschillende ringen, ik wil verschilende attracties voorzien van verschillende effecten.
Ik heb al gevonden hoe ik de verschillende ringen moet aansturen met een en dezelfde effect.
Nu heb ik dus een "database"van effecten en ik wil dus een aantal effecten op de ringen laten afvuren.
Ik probeer eerst 1 effect op ring5 uit te laten voeren maar krijg een 'setAll' was not declared in this scope", Ik zit me er al dagen op te turen maar ik zie niet wat ik mis.
Wie o wie wil de prog bekijken en mij opweg helpen?
#include <Adafruit_NeoPixel.h>
#define PIN1 2 //connect 12 Neopixel strip to Digital PIN6 24leds
#define PIN2 10 //connect 6 Neopixel strip to Digital PIN7 44leda
#define PIN3 6 // connect 24 Neopixel ring to Digital PIN8 60leds
#define PIN4 13 // connect 16 Neopixel ring to Digital PIN9 48leds
#define PIN5 10 // connect 10 Neopixel ring to Digital PIN9 8leds
#define NUMPIXELS1 24
#define NUMPIXELS2 44
#define NUMPIXELS3 60
#define NUMPIXELS4 48
#define NUMPIXELS5 8
Adafruit_NeoPixel pixels1 = Adafruit_NeoPixel(NUMPIXELS1, PIN1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels2 = Adafruit_NeoPixel(NUMPIXELS2, PIN2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels3 = Adafruit_NeoPixel(NUMPIXELS3, PIN3, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels4 = Adafruit_NeoPixel(NUMPIXELS4, PIN4, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels5 = Adafruit_NeoPixel(NUMPIXELS5, PIN5, NEO_GRB + NEO_KHZ800);
const int spPot = 0; // wire speed pot to Analog0 (Rings)
const int spPot1 = 1; // wire speed pot to Analog1 (Strips)
const int colorPot1 = 2; // wire color wheel pot to Analog2 (First Strip)
const int colorPot2 = 3; // wire color wheel pot to Analog3 (Second Strip)
const int colorPot3 = 4; // wire color wheel pot to Analog4 (Rings)
const int colorPot4 = 5; // wire color wheel pot to Analog5 (Mini-Strip)
//Neopixel loop variables
unsigned int counter1 = 0;
unsigned int counter2 = 0;
unsigned int counter3 = 0;
unsigned int counter4 = 0;
unsigned int counter5 = 0;
int brightness = 100; // 0 to 255 valid (1 to 100 work best)
int colorW = 85; // 0 to 255 valid green is 85
int sp = 100; // 1000 to 10 work good (slow to fast)
int spOther = 100;
int ct = 3; // number of pixels on in a group
int nGroups = 6; // number of groups (even divisible of pixels 1,2,3,4,5,6,10,12)
//millis count variables
unsigned long previousMillis1 = 0; // will store last time you ran your code
unsigned long previousMillis2 = 0;
unsigned long previousMillis3 = 0;
unsigned long previousMillis4 = 0;
unsigned long previousMillis5 = 0;
void setup() {
pixels1.begin();
pixels2.begin();
pixels3.begin();
pixels4.begin();
pixels5.begin();
pixels1.show();
pixels2.show();
pixels3.show();
pixels4.show();
pixels5.show();
pixels1.setBrightness(brightness);
pixels2.setBrightness(brightness);
pixels3.setBrightness(brightness);
pixels4.setBrightness(brightness);
pixels5.setBrightness(brightness);
}
void loop() {
ring1();
ring2();
ring3();
ring4();
ring5();
}
void ring1() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
//Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
//TwinkleRandom(20, 100, false);
// RunningLights(0xff,0,0, 50); // rood
//RunningLights(0xff,0xff,0xff, 50); // wit
//RunningLights(0,0,0xff, 50); // blauw
//colorWipe(0x00,0xff,0x00, 50);
//colorWipe(0x00,0x00,0x00, 50);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//CylonBounce(0xff, 0, 0, 4, 10, 50);
//Sparkle(random(255), random(255), random(255), 0);
SnowSparkle(0x0, 0x0, 0x0, 20, 200);
}
void ring2() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
//Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
//TwinkleRandom(20, 100, false);
// RunningLights(0xff,0,0, 50); // rood
//RunningLights(0xff,0xff,0xff, 50); // wit
//RunningLights(0,0,0xff, 50); // blauw
//colorWipe(0x00,0xff,0x00, 50);
//colorWipe(0x00,0x00,0x00, 50);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//CylonBounce(0xff, 0, 0, 4, 10, 50);
//Sparkle(random(255), random(255), random(255), 0);
SnowSparkle(0x0, 0x0, 0x0, 20, 200);
}
void ring3() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
//Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
//TwinkleRandom(20, 100, false);
// RunningLights(0xff,0,0, 50); // rood
//RunningLights(0xff,0xff,0xff, 50); // wit
//RunningLights(0,0,0xff, 50); // blauw
//colorWipe(0x00,0xff,0x00, 50);
//colorWipe(0x00,0x00,0x00, 50);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//CylonBounce(0xff, 0, 0, 4, 10, 50);
//Sparkle(random(255), random(255), random(255), 0);
SnowSparkle(0x0, 0x0, 0x0, 20, 200);
}
void ring4() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
//Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
//TwinkleRandom(20, 100, false);
// RunningLights(0xff,0,0, 50); // rood
//RunningLights(0xff,0xff,0xff, 50); // wit
//RunningLights(0,0,0xff, 50); // blauw
//colorWipe(0x00,0xff,0x00, 50);
//colorWipe(0x00,0x00,0x00, 50);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//CylonBounce(0xff, 0, 0, 4, 10, 50);
//Sparkle(random(255), random(255), random(255), 0);
SnowSparkle(0x0, 0x0, 0x0, 20, 200);
}
void ring5() {
// Slower:
// Strobe(0xff, 0x77, 0x00, 10, 100, 1000);
// Fast:
//Strobe(0xff, 0xff, 0xff, 10, 50, 1000);
//TwinkleRandom(20, 100, false);
// RunningLights(0xff,0,0, 50); // rood
//RunningLights(0xff,0xff,0xff, 50); // wit
//RunningLights(0,0,0xff, 50); // blauw
//colorWipe(0x00,0xff,0x00, 50);
//colorWipe(0x00,0x00,0x00, 50);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//meteorRain(0xff,0xff,0xff,2, 64, true, 30);
//CylonBounce(0xff, 0, 0, 4, 10, 50);
//Sparkle(random(255), random(255), random(255), 0);
SnowSparkle(0x10, 0x10, 0x10, 20, random(100,1000));
}
void SnowSparkle(byte red, byte green, byte blue, int SparkleDelay, int SpeedDelay) {
setAll(red,green,blue);
for(int i = 0; i < NUMPIXELS5; i++ )
int Pixel = random(NUMPIXELS5);
setPixel(Pixel,0xff,0xff,0xff);
showStrip();
delay(SparkleDelay);
setPixel(Pixel,red,green,blue);
showStrip();
delay(SpeedDelay);
}
// ***************************************
// ** FastLed/NeoPixel Common Functions **
// ***************************************
// Apply LED color changes
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
FastLED.show();
#endif
}
// Set a LED color (not yet visible)
void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
// NeoPixel
strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
// FastLED
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
#endif
}
// Set all LEDs to a given color and apply it (visible)
void setAll(byte red, byte green, byte blue)
showStrip();
}
5_ringenNeopixel_verschillende_effecten_verschillende_aantal_le.ino (7.16 KB)