5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10



Microbit Halo Programmable Expansion Board Tutorial 1.5 Sound test

Posted by Fiona Su on

Microbit Halo Programmable Expansion Board Tutorial 1.5 Sound test (download)

1.Principle:

Microphone is connected to the P1 of micro:bit and detects the current sound size by reading the analog value of the micro:bit P1. The larger sound of the current environment, the larger the analog value read, the smaller sound of the current environment, and the smaller the analog value read.

2. Learning goals:

In this lesson we will learn how to realize that when the larger sound of the current environment, the longer the graphic bar on the dot matrix; the smaller sound of the current environment, the fewer the graphic bars on the dot matrix.

3. Programming method:

Online programming:

First, we need to connect the micro:bit to the computer by USB data cable, the computer will pop up a USB flash drive.Then, click on the URL in the USB flash drive: http://microbit.org/ to enter the edit process interface.

 

Offline programming:

Open the offline programming softwareimage.png,download address of this software: http://www.microbitgo.com/code.

After creating a new project, you need to load the Neopixel library to program the programmable RGB lights. To load the library, click on 【Advanced】—【Extensions】 — click on 【Neopixel】, and you will see an extra column in the programming interface. As shown in the figure below.

image.png 

image.png 

image.png 

General program diagram:

image.png 

Our programmable RGB lamp is connected to the pin2 of micro:bit, so the pin2 is set to no pull-up/pull-down mode by default. Then use the following statement to create a new NeoPixel driver named Strip.

image.png 

The initialize strip is set to black, meaning that the RGB light is turned off. 

image.png 

Then in the main loop, we need to use the draw graph bar statement to display the analog value of the read P1 as a graph bar on the dot matrix. The maximum value is 1023.

image.png 

4.Download program

We need to make sure that the micro:bit board is connected to the computer. Click the download in the lower left corner as shown below, and select the download path as micro:bit drive letter to download the program.

image.png 

5.Experimental phenomena

After the program is successfully downloaded, you can see that fewer the graphic bars on the dot matrix. When we increase the sound or take a breath to microphone, the graphic bar will grow. As shown in the figure below.

image.png 

image.png 

Tutorial

Microbit Halo Programmable Expansion Board Tutorial

Buy Yahboom Microbit Halo Programmable Expansion Board

 

0 comments

Leave a comment

Please note, comments must be approved before they are published