Hi I was wondering if someone is able to help me! I am currently trying to get a strip of 10 neopixels to change colour. I want to be able to code a random neopixel in the strip to change to either red, blue, green and yellow consecutively after 2 seconds. I am relatively new to Arduino so I'm still learning. I have been using the code below and it does everything that I want it to but I would like to set the colour so they're not as randomised. I found this code online.
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define LED_COUNT 50
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_RGB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
randomPixelColor(100);
}
void randomPixelColor(int wait)
{
int i= random(strip.numPixels());
uint32_t c = random(2147483647); // I have no idea what this crazy number does.
strip.setPixelColor(i, c);
strip.show();
delay(1000);
} // end void randomPixelColor()
I don't even know if this is the right code to be using! Hopefully someone can help me cause I'm so confused.