#include <FastLED.h>
#define DATA_PIN 4
#define NUM_LEDS 16
const int pot_Pin = 34;
CRGB leds[NUM_LEDS];
int vertraging= 100;
void setup() {
Serial.begin(115200);
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
}
void loop()
{
int potValue = analogRead(pot_Pin);
float voltage = (map(potValue, 0, 1023, 0, 500) / 100.0); // Map analoge waarde to spanning (0-5V)
voltage = voltage / 4;
Serial.print("Spanning: ");
Serial.println(voltage); // Display spanning met 2 decimale plaatsen
// Map voltage to a color gradient from green to orange to red
CRGB color = CHSV(map(voltage, 0, 5, 96, 0), 255, 255);
// selecteer de kleur op de LED strip
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = color;
}
FastLED.show();
delay(vertraging);
}