#include <Adafruit_NeoPixel.h>
#define PIN 8
#define NUMPIXELS 16
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.clear(); // Set all pixel colors to 'off'
pixels.show(); // Send the updated pixel colors to the hardware.
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop() {
int data = analogRead(A0);
float resolution = 5.0 / 1023 ;
float volt = data * resolution ;
Serial.print("Data = " + String(data));
Serial.println("\t Volt= " + String(volt));
pixels.clear(); // Set all pixel colors to 'off'
pixels.show(); // Send the updated pixel colors to the hardware.
float d = 5.0 / 16 ; // delta = 1.25v
int n = volt / d ; // LED number
pixels.setPixelColor(n, pixels.Color(255, 255, 0)); // R G B - 0 .. 255
pixels.show(); // Send the updated pixel colors to the hardware.
delay(100);
}