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 the music bit, IR bit, button bit and a dc motor 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 music turntable
from edubit import *
import music
time = 0
start = 0
mode = 0
state = False
while True:
init()
if button_b.is_pressed():
run_motor(M1,Forward,20)
sleep(3000)
mode = 1
elif button_a.is_pressed():
music.stop()
brake_motor(M1)
mode = 0
if is_IR_sensor_triggered() == True and is_IR_sensor_triggered() != state:
start = running_time()
state = True
elif is_IR_sensor_triggered() == False and is_IR_sensor_triggered() != state:
end = running_time()
time = end - start
state = False
if mode == 1:
if time > 170:
music.play(music.NYAN,wait=False,loop=True)
UPLOAD
MUEDITOR
Connect EDU:BIT to your computer using a USB cable. Click on the Flash button to upload the program.
Pythoneditorfor 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