VMM501
V. 01 – 17/01/2019
23
©Velleman nv
5.10
Motor
1x micro:bit board
1x micro:bit breadboard adapter
1x breadboard
1x diode
1x 100 Ω resistor (brown/black/brown/gold)
1x self-locking or bi-stable switch
1x N-channel MOSFET
1x mini motor
1x battery holder with 2x AA 1.5 V battery
We are going to use a switch to control the start and stop of a motor.
Place the necessary components on the breadboard as shown.
Have a look at the code below.
1.
Drag and drop the code blocks to form the code as shown.
2.
The
on start
block runs only once to start the programme.
3.
Set the value of
P0
to
0
.
4.
Set the
pull pin
block to
P1
and
up
.