MicroPython

From Noisebridge
Revision as of 10:53, 2 February 2019 by (talk | contribs) (Mac tips)
Jump to navigation Jump to search

This is all about micropython.org in particular using it with ESP8266 & ESP32

programs

solid color neopixels (WS2812b)

from machine import Pin
from neopixel import NeoPixel

NEO_PIN = const(3)
NEO_COUNT = const(72)

neo = Pin(NEO_PIN, Pin.OUT)
np = NeoPixel(neo, NEO_COUNT)

#        R   G   B
color = [0, 20, 20]

def stripColor():
    global NEO_COUNT, np, color
    for x in range(0, NEO_COUNT):
        np[x] = color
    np.write()

# update the entire strip with one color
stripColor()

firmware/flashing

Instructions for flash and pre-compiled binaries can be found at: https://micropython.org/download

Source and instructions for compiling yourself are available at: https://github.com/micropython/micropython


Mac OS X tips