2018年10月28日星期日

Microbit Project 10: DJ PANEL

Components needed

Main control board of micro:bit
Expansion board of micro:bit
1× Rainbow LED strip
1× knob module
1× USB cable

Hardware Connection

Connect the knob module to the interface P1 of expansion board;
Connect the rainbow LED strip to the interface P2 of expansion board.




















Program
Functions: Realize the music performance with the LED strip when adjusting the rotation angle of the knob.

When the knob is turned by hand, the value of the P1 pin changes from 0 to 1023 and is divided into 8 small ranges, corresponding to one octave "Do ~ Do’" in the music and the number of changing LEDs of the the light strip.
The input value of P1SoundThe LED strip
0-128Do                          Light one LED
128-256ReLight two LEDs
256-384MeLight three LEDs
384-512FaLight four LEDs
512-640SoLight five LEDs
640-768LaLight six LEDs
768-996TiLight sever LEDs
996-1023Do'Light seven LEDs in red
STEP1:  the logic diagram to realize DJ bandstand.
















STEP2: the editing of logic statement "if", the operations go as follows.
























STEP3: judge the range of the input value of the knob(P1) and make the value correspond to the LED strip and sound. The following is the control procedures in the first area.







STEP4: Since there are only 7 LEDs, so "Do’" can be expressed in a different way in the 8th zone. 






STEP5:the final program











Exercises for improvement

Utilize the 5×5 LED matrix of the micro:bit. When different syllables are played, each of them should be correspondingly displayed by LEDs. Just have a try. 



没有评论:

发表评论