Change the number of LED’s that glow according to the slider

Make things

The number of LEDs on the tape LED will change according to the position of the slider on the web page.

Materials

  • LEDTape LED and ring LED using WS2812
  • obniz Board
  • Mobile batteries, etc.
  • Smart Phone or PC

How to make

Hardware connection

Connect the tape LED to the obniz board as shown in the figure with reference to the parts library of WS2812.

obniz Tape LED with WS2812
0 GND
1 DIN
2 VCC

 

 

Software

To create a slider, use the input element’s range type in HTML.

<input id="slider" type="range" value="0" min="0" max="8" step="1" />

Rewrite the “max=”8” part according to the number of tape LEDs you have.

In line 4 of code.js, rewrite the const NUM_OF_LEDS = 8; in the same way.

Program