Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <FastLED.h>
- #define NUM_LEDS 1
- #define LED_PIN 6
- #define COLOR_ORDER GRB
- #define LED_TYPE WS2812
- CRGB leds[NUM_LEDS];
- int poti1 = 0; //brightness @ pin A0
- int poti2 = 1; //hue @ pin A1
- int poti3 = 2; //saturation @ pin A2
- int poti1val = 0;
- int poti2val = 0;
- int poti3val = 0;
- uint8_t brightness = 0;
- uint8_t hue = 0;
- uint8_t saturation = 0;
- void setup() {
- delay(3000); // safeguard delay
- LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
- }
- void loop() {
- poti1val = analogRead(poti1);
- poti2val = analogRead(poti2);
- poti3val = analogRead(poti3);
- brightness = map(poti1val, 0, 1023, 0, 255);
- hue = map(poti2val, 0, 1023, 0, 255);
- saturation = map(poti3val, 0, 1023, 0, 255);
- for (int i = 0; i < NUM_LEDS; i++) {
- leds[i] = CHSV(brightness, hue, saturation);
- }
- FastLED.show();
- delay(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement