top of page

Responsive fixture
















Components

  • 5V LED strip

  • Arduino Uno

  • Photoresistor LDR Light Sensor Module 4 Pin

  • Acrylic box/sheet

  • Mulberry Paper



Code:


#define NUM_LEDS 300 // total number of LEDS


#define DATA_PIN 7


CRGB leds[NUM_LEDS];


void setup() {

Serial.begin(9600);

LEDS.addLeds<WS2812B,DATA_PIN,RGB>(leds,NUM_LEDS);

}



void loop() {

static uint8_t hue = 0;



// read the sensor on analog pin 0:

int sensorValue = analogRead(A0);

delay(100);

Serial.println(sensorValue);


// map the sensor value to the brightness

int ssValue = map(sensorValue, 90, 1023, 0, 255);

// run towards the end

for(int i = 0; i < NUM_LEDS; i++) {

leds[i] = CHSV(0, 0, 255);

LEDS.setBrightness(ssValue);

FastLED.show();


}


}

Post: Blog2_Post
bottom of page