EDU:BIT is a beginner-friendly micro:bit kit specially designed to encourage kids to explore STEAM and learn coding.
MicroPython is an open source Python programming language interpreter that runs on small embedded development boards.
This project uses a dc motor and a servo included in the kit.
SOFTWARE SETUPMU EDITOR
Step 1: Download and install MU editor
Download MU editor at: https://codewith.mu/en/download
Click on the downloaded file to install MU editor
Step 2: Add module
Download MicroPython module from GitHub: https://github.com/Bhavithiran97/micropython-edubit
Copy edubit.py file and paste it in your computer's mu_code folder
- On Windows, the path is: C:\Users<username>\mu_code
- On Macintosh, the path is: Macintosh HD>Users>username>mu_code
Connect EDU:BIT to your computer using a USB cable and open MU editor.
Click in the Files button in the MU editor
A file panel will appear in the bottom of the editor
Drag and drop edubit.py from the right panel to left panel
Python editor for micro:bit
Step 1: Open Python Editor
Open Python editor at: https://python.microbit.org/v/2.0
Step 2: Add module
Download MicroPython module from GitHub: https://github.com/Bhavithiran97/micropython-edubit
Click on the Load/Save button in the editor
Click Show File (1) and Add file button
Add edubit.py to the editor
CODING
To program the EDU:BIT you need to:
- Use
from edubit import *
at the top of your program - Use
init()
inside awhile True
loop to monitor the power switch and reset microbit when power cycled.
Here is the example code for pedestrian crossing traffic light project
from edubit import *
while True:
init() # initialize EDU:BIT
brake_motor(M1) # stops the motor
sets_servo_position(S1, position=30) # sets servo position to down
brake_motor(M1)
sleep(1500)
run_motor(M1,Forward, speed=255) # runs motor
sets_servo_position(S1, position=130) # sets servo position to up
sleep(4000)
UPLOAD
MU EDITOR
Connect EDU:BIT to your computer using a USB cable. Click on the Flash button to upload the program.
Python editor for micro:bit
Connect EDU:BIT to your computer using a USB cable. Click on the Download button and download it into microbit folder to upload the program.
TESTING
Comments