Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
68
/
86
Connection
Connect the knob module to P1;
Connect the RGB LED strip to P2.
Program
Goal: In this project, the smart music box and the LED strip be combined to realize the music
performance with the LED strip when manually adjusting the rotation angle of the knob.
When the knob is turned by hand, the value of P1 changes from 0 to 1023 and is divided into 8
small ranges, corresponding to one octave "Do ~ Do’" and the number of LED(s) to be lighted .
The input value of P1
Sound
The LED strip
0-128
Do
Light one LED
128-256
Re
Light two LEDs
256-384
Mi
Light three LEDs
384-512
Fa
Light four LEDs
512-640
So
Light five LEDs
640-768
La
Light six LEDs
768-996
Ti
Lights seven LEDs
996-1023
Do’
Light seven LEDs in red