#include <FastLED.h>
#define NUM_LEDS 60
#define LED_PIN 5
#define POT_PIN 4
#define BT_PIN 2
#define LED_TYPE WS2812B /* I assume you have WS2812B leds, if not just change it to whatever you have */
#define BRIGHTNESS 255 /* Control the brightness of your leds */
#define SATURATION 255 /* Control the saturation of your leds */
CRGB leds[NUM_LEDS];
int buttonState = 1;
void setup() {
FastLED.addLeds<LED_TYPE, LED_PIN, GRB>(leds, NUM_LEDS);
//FastLED.setBrightness(100);
Serial.begin(115200);
pinMode(BT_PIN, INPUT_PULLUP);
pinMode(POT_PIN, INPUT);
}
unsigned int newTime = 0;
uint8_t hue = 0;
void loop() {
buttonState = digitalRead(BT_PIN);
if (buttonState == LOW){
Serial.println("Button Pressed");
}else{
uint16_t potRead = analogRead(POT_PIN);
uint8_t brightness = map(potRead, 0, 1023, 0, 200);
Serial.println(brightness);
FastLED.setBrightness(brightness);
EVERY_N_MILLISECONDS(100){
hue += 10;
leds[0] = CHSV(hue, 255, 255);
}
}
FastLED.show();
}