000 - ESP32 MicroPython: How to Get Started with MicroPython

Introduction

In this article you will learn how to get started with MicroPython explorations. We will begin to learn to install first a Thonny Python IDE for developing MicroPython codes for development board of your choice. I will be using an ESP32 development board.

Instruction

  1. Download the Thonny Python IDE at:
    Download Thonny Python
    This is one of the best, beautiful, and beginner-friendly IDE available. We will also use Thonny Python to erase and flash new firmware to ESP32 with the help of esptool pluggins.

  2. Download the MicroPython firmware from:
    Download Firmware at MicroPython.org
    Go to download section and look for your development board. Choose the stable bin file for your board.

  3. Download the ESP32 USB driver at:
    Download ESP32 USB driver

  4. Download some references files for your development board like pinouts and schematic diagram.

  5. Install Thonny Python

  6. Install the ESP32 USB driver

  7. Flash a new firmware to ESP32 using the Thonny Python.

Video Demonstration

Call To Action

If you find this tutorial as helpful, please take time to share it so that it can reach more people who might benefited from this.

Please kindly support me by Subscribing to my Youtube channel: Click this to SUBSCRIBE to TechToTinker

Source Code

Example 1, Turn ON or turn OFF the onboard LED

 1
 2# Load the 'machine' module to access the hardware
 3import machine
 4
 5# Create an 'led' object in pin 2
 6# and set the pin direction to output
 7led = machine.Pin(2, machine.Pin.OUT)
 8
 9# This turns on or turns off the 'led'
10led.on()
11led.off()
12
13# This is the same as the above code
14# but now we are passing a value
15led.value(1)
16led.value(0)
17
18# This is the same as the above code
19# as you already know
20#	1 = True
21#	0 = False
22led.value(True)
23led.value(False)
 1
 2# Load the 'machine' module to access the hardware
 3import machine
 4
 5# Load the 'time' module which includes the 'sleep' class
 6import time
 7
 8# Create an 'led' object in pin 2
 9# and set the pin direction to output
10led = machine.Pin(2, machine.Pin.OUT)
11
12# Create an eternal loop that blinks the LED
13# time.sleep(0.5) creates a 0.5 second delay
14# or 500 milli seconds
15while True:
16    led.on()
17    time.sleep(0.5)
18    led.off()
19    time.sleep(0.5)


Posts in this series



No comments yet!

GitHub-flavored Markdown & a sane subset of HTML is supported.