MicroPython: Difference between revisions
Jump to navigation
Jump to search
m (Ⅹ moved page ΜPy to MicroPython over redirect) |
(let there be rgb) |
||
| Line 1: | Line 1: | ||
This is all about [https://micropython.org/ micropython.org] in particular using it with [[ESP8266]] & [[ESP32]] | This is all about [https://micropython.org/ micropython.org] in particular using it with [[ESP8266]] & [[ESP32]] | ||
== programs == | |||
=== solid color neopixels (WS2812b) === | |||
<pre> | |||
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() | |||
</pre> | |||
== 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 | |||
Revision as of 20:31, 4 January 2018
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