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
-
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. -
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. -
Download the ESP32 USB driver at:
Download ESP32 USB driver -
Download some references files for your development board like pinouts and schematic diagram.
-
Install Thonny Python
-
Install the ESP32 USB driver
-
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)
Example 2, Blink the onboard LED
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
- 026 - ESP32 MicroPython: MFRC522 RFID Module
- 025 - ESP32 MicroPython: ESP32 Bluetooth Low Energy
- 024 - ESP32 MicroPython: How to Use SD Card in MicroPython
- 023 - ESP32 MicroPython: Binary Clock
- 022 - ESP32 MicroPython: MQTT Part 2: Subscribe
- 021 - ESP32 MicroPython: MQTT Part 1: Publish
- 020 - ESP32 MicroPython: RESTful APIs | Demo READ and WRITE
- 019 - ESP32 MicroPython: OpenWeather | RESTful APIs
- 018 - ESP32 MicroPython: Thingspeak | RESTful APIs
- 017 - ESP32 MicroPython: DHT Values Auto Updates using AJAX
- 016 - ESP32 MicroPython: Web Server | ESP32 Access Point
- 015 - ESP32 MicroPython: Web Server | ESP32 Station Mode in MicroPython
- 014 - ESP32 MicroPython: SIM800L GSM Module in MicroPython
- 013 - ESP32 MicroPython: UART Serial in MicroPython
- 012 - ESP32 MicroPython: HC-SR04 Ultrasonic Sensor in MicroPython
- 011 - ESP32 MicroPython: DHT11, DHT22 in MicroPython
- 010 - ESP32 MicroPython: 0.96 OLED in MicroPython
- 009 - ESP32 MicroPython: Non-blocking Delays and Multithreading | Multitasking
- 008 - ESP32 MicroPython: Hardware Timer Interrupts
- 007 - ESP32 MicroPython: How to make some sound with MicroPython
- 006 - ESP32 MicroPython: How to control servo motor with MicroPython
- 005 - ESP32 MicroPython: Pulse Width Modulation
- 004 - ESP32 MicroPython: External Interrupts
- 003 - ESP32 MicroPython: General Purpose Input Output | GPIO Pins
- 001 - ESP32 MicroPython: What is MicroPython
No comments yet!