MicroPython is fun

Check out my new toy, the ESP32 (Adafruit Huzzah32 board)! Linux is nice, the driver for the USB <-> Serial chip is of course build into the kernel, just plug and play. You get a Python REPL prompt and 100kb free memory to play with :slight_smile:

Here is a little “hello world”, fading a LED with PWM.

from machine import Pin, PWM
from time import sleep

frequency = 5000
led = PWM(Pin(21), frequency)

while True:
    for duty_cycle in range(0, 1024):
        led.duty(duty_cycle)
        sleep(0.001)
    for duty_cycle in range(1023, 0, -1):
        led.duty(duty_cycle)
        sleep(0.001)
6 Likes

Embedded Python = very cool stuff. :grin:

2 Likes

Indeed, I just started playing with this. It’s a bit more beginner friendly than C and I also found a nice IDE (Thonny, written in Python by the way) which makes it easy to start experimenting (it can download scripts to the ESP automatically over the serial connection). I have a DS18B20 digital temp sensor that communicates over 1-wire, that is the next thing I will try. There are of course already Python modules both for 1-wire and the DS18B20 available, it’s Python after all.

Also, it’s looks like you can deploy a web server on the ESP32, it’s a dual-core beast clocking along at 240 MHz. And it got WiFi and BT as well!

1 Like