I am very new to Arduino. Mine just arrived yesterday.
I apologize that I do not have any example code to post. I can't find a sufficiently stripped-down existing project to modify. I hope someone here can point me in the right direction. I can use code blocks for certain projects, but there do not appear to be NeoPixel code blocks. I'm not having luck editing published projects.
I don't expect you to sit and write code for me - just maybe some guidance if you're feeling it.
What I hope to achieve, and ultimately incorporate into a larger project, is pretty simple.
- 5 leading pixels spinning in bright green
- 3 trailing pixels trailing behind in a dimmer green
- circle the ring maybe twice a second
Any guidance you can provide would be greatly appreciated. I apologize in advance if I am a jerk.
#include <Adafruit_NeoPixel.h>
#define PixelPin 6
#define PixelCount 16
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(PixelCount, PixelPin, NEO_GRB + NEO_KHZ800);
uint32_t colour = 0x00FF00; // Default to Green
int pos = 0;
void setup()
{
pixels.begin();
pixels.setBrightness(85); // 1/3 brightness
}
void loop()
{
int start = (millis()%500) * PixelCount / 1000L; // two rev per second
for(int i = 0; i<5; i++) {
pixels.setPixelColor((i+start) % PixelCount, colour);
}
for(int i = 5; i<PixelCount; i++) {
pixels.setPixelColor((i+start) % PixelCount, 0);
}
pixels.show();
}