Micro python course 4.Display custom animation
This lesson learns to display custom animation on a micro:bit dot matrix by Python programming. For example: from smile to sadness and then to anger.
from microbit import *
face1 = Image("00000:09090:00000:90009:09990")
face2 = Image("00000:09090:00000:99999:00000")
face3 = Image("00000:09090:00000:09990:90009")
face4 = Image("90009:99099:00000:09990:90009")
face5 = Image("00000:00000:00000:00000:00000")
all_faces = [face1, face2, face3, face4, face5, ]
Programming and downloading：
1.You should open the Mu software, and enter the code in the edit window, , as shown in Figure 4-1.
Note! All English and symbols should be entered in English, and the last line must be a space.
2.As shown in Figure 4-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 4-3.
4. After the download is successful, you can observe the animation of the expression change on the micro:bit dot matrix, as shown in Figure 4-4 to Figure 4-7.
Figure 4-4 Figure 4-5
Figure 4-6 Figure 4-7
The code of the experiment: 4.Display custom animation.zip
Micro Python Basic Course
- Micro Python Basic Course 1.Hello,World
- Micro Python Basic Course 2: Display built-in image
- Micro Python Basic Course 3: Display custom image
- Micro Python Basic Course 4: Display custom animation
- Micro Python Basic Course 5: Button game
- Micro Python Basic Course 6: Do not touch me
- Micro Python Basic Course 7: Play built-in music
- Micro Python Basic Course 8: micro:bit voice talk