Micropython Lesson 1
Setting up the environment for Micropython
MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments. Learn more about MicroPython
- Download and install http://thonny.org/
- Open the Magicbit Utility and connect the Magicbit Board to the PC
- Choose the port connected to the device and choose Micropython as the platform
- Click ‘Update Firmware’
- Open Thonny IDE
- Click Run > Select Interpreter
- Choose Micropython(ESP32) from the first dropdown box and leave the other dropdown box as it is.
To check whether drivers are correctly installed open the Ardunio IDE and go the Tools menu. There should be a port (Eg:COM1) shown when plugging Magicbit to the computer as shown below. If not please follow Installation drivers section.
- Open Thonny IDE
- Paste following code on editor and click save as
from machine import Pin import time led = Pin(16, Pin.OUT) for i in range(10): led.on() time.sleep_ms(500) led.off() time.sleep_ms(500)
- Click ‘Micropython Device’ and choose file name as ‘boot.py’
-Click Run (Green Arrow) on the IDE – If Green Led on backside of the Magicbit is blinking your have just begun the magic with Magicbit
Brain of the magicbit is ESP32, which is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. Therefore any project or document available on internet which supports ESP32 is supported for Magicbit as well.
- Processor – Xtensa dual-core
- Speed– Up to 240Mhz
- Flash Memory-4MB
- Inputs-Pushbutton, LDR, Potentiometer
- Outputs-LEDs, OLED Display, Buzzer
- Other– Dual Motor Driver, Li-Ion Charger
- Connectivity– USB, WiFi, Bluetooth