Microbit-Python Course 6.9 Small fan
This lesson learns to use the Python language to program the fan motor to turn. After pressing the A button, the fan starts to rotate and there is an animation of the fan turning on the dot matrix.
from microbit import *
fun1 = Image("00990:90900:99999:00909:09900")
fun2 = Image("99009:09099:00900:99090:90099")
all_fun = [fun1, fun2]
Programming and downloading：
1.You should open the Mu software, and enter the code in the edit window, , as shown in Figure 9-1.
Note! All English and symbols should be entered in English, and the last line must be a space.
2. As shown in Figure 9-2, you need to click the Check button to check if our code has an error. If a line appears with a cursor or an underscore, the program indicating this line is wrong.
3.You need to connect the micro data cable to micro:bit and the computer, then click the Flash button to download the program to micro:bit as shown in Figure 9-3.
4. About wiring
5. After the download is successful, we can see a heart on the micro:bit dot matrix, as shown in Figure 9-5. When the A button is pressed, the fan starts to rotate, and an animation of the fan rotation appears on the dot matrix, as shown in Figure 9- 6, 9-7.
Figure 9-6 Figure 9-7
The code of the experiment: 9.Small fan.rar