Could anyone help me with figuring out how to program a potentiometer to control the brightness of the LEDs on the neopixel ring? This is my current setup as well as the code. I think I have the potentiometer wired correctly, but can't figure out how to program it to control the LEDs brightness while still supplying enough voltage to the LEDs. Any help or guidance is greatly appreciated. Also fair warning, I am new to programming and working on projects like this so I am not the most knowledgeable.
Setup:
Code:
include <Adafruit_NeoPixel.h>
ifdef AVR
#include <avr/power.h>
endif
define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800); //
void setup() {
strip.begin(); strip.show(); // Initialize all pixels to 'off' }
void loop() {
colorWipe(strip.Color(25, 227, 227), 250); // Red colorWipe(strip.Color(25, 127, 227), 209); // Green colorWipe(strip.Color(25, 28, 227), 168); // Blue
colorWipe(strip.Color(123, 0, 255), 100); // Blue colorWipe(strip.Color(153, 25, 227), 45); // Green colorWipe(strip.Color(227, 25, 200), 20); // Red
colorWipe(strip.Color(153, 25, 227), 86); // Green colorWipe(strip.Color(123, 0, 255), 127); // Blue colorWipe(strip.Color(25, 28, 227), 168); // Blue colorWipe(strip.Color(25, 127, 227), 209); // Green colorWipe(strip.Color(25, 227, 227), 250); // Red
colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
}
void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); strip.show(); delay(wait); } }