Goal


Materials


Background


What is a “smart decibel tester”.

Principle of a smart decibel tester


Colors | Paremeters :-: | :-: Red|30db Orange|40db Yellow|50db Green|60db Blue|70db Indigo|80db Purplish blue|90db Purple|100db White|110db Blue|120db

Practical Operation


The front side:

The back side:

Set and stick components as below:

Hardware Connect


Connect the analog noise sensor to the P1 port of the expansion board. Connect the Rainbow LED to the P2 port of the expansion board.

Software


makecode

Programming


Step 1

Note:If there is a hint says some codebase will be deleted because of incompatibility. Don’t worry. You could go ahead as the hint or build a new item in the item menu bar.

Step 2

Snap the on start block from the Basic, then snap the set to NeoPixel at pin with leds as from the Neopixel. Initialize the rainbow LED to RGB of the P2 port.

Step 3

Snap the show icon in the forever, it means the smart decibel tester in proper functioning. Then snap an if statement to judge the value the analog noise sensor at P1 port. When the value is greater than 30(in quiet situation), snap the strip show color block and set the color to red. Duplicate the above code and change the value to 40,50,60…, set different color to each value.

Program

Program link:https://makecode.microbit.org/_HXrf1jaJtHPt

You also could directly download program by visiting website as below:


Result


Think


Questions


More Information