VMM501
V. 01 – 17/01/2019
21
©Velleman nv
1.
Drag and drop the code blocks to form the code as shown.
You can find the
servo write pin
P0
to
180
block in
Pins
in the Code
Drawer. You can find the
forever
and
pause (ms)
100
in
Basic
in the
Code Drawer.
2.
Set
P0
to
P1
and set the value to 0.
3.
Set the
pause
to 2000 ms.
4.
Set
P0
to
P1
. Also, set the value 0 to 180.
5.
Set the
pause
to 2000 ms.
6.
When complete, we compile the programme and generate a hex. file. Click
on the download button and save the hex. file to the Downloads folder
C:\downloads. This hex. file is ready to upload to the micro:bit.
Plug the micro:bit into a USB port. The, drag and drop the hex. file onto the
micro:bit removable device to upload the programme.
We can see the servo rotating from 0 to 180 degrees. Now, how would you make a dial thermometer with a
temperature sensor and servo?
5.9
Buzzer
1x micro:bit board
1x micro:bit breadboard adapter
1x breadboard
1x mini speaker
1x N-channel MOSFET
1x 100 Ω resistor (brown/black/brown/gold)
We are going to drive a buzzer.
Place the necessary components on the breadboard as shown.