summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp8266
diff options
context:
space:
mode:
authormisterdanb <danb@hasi.it>2016-03-28 01:58:14 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-05-19 22:29:11 +0300
commita0a08b4be1583aa7a4ef33d3b1b0aa6553732eca (patch)
tree278812b070128898c4afade05b0781a622bb515f /docs/esp8266
parent6fa60153eae746bee4657ae3fcd69e71144c6d59 (diff)
downloadmicropython-a0a08b4be1583aa7a4ef33d3b1b0aa6553732eca.tar.gz
micropython-a0a08b4be1583aa7a4ef33d3b1b0aa6553732eca.zip
esp8266: Add APA102 serial individually controllable LEDs support.
APA102 is a new "smart LED", similar to WS2812 aka "Neopixel".
Diffstat (limited to 'docs/esp8266')
-rw-r--r--docs/esp8266/quickref.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/esp8266/quickref.rst b/docs/esp8266/quickref.rst
index d2d677dc79..7b246a65e1 100644
--- a/docs/esp8266/quickref.rst
+++ b/docs/esp8266/quickref.rst
@@ -271,6 +271,26 @@ For low-level driving of a NeoPixel::
import esp
esp.neopixel_write(pin, grb_buf, is800khz)
+APA102 driver
+-------------
+
+Use the ``apa102`` module::
+
+ from machine import Pin
+ from apa102 import APA102
+
+ clock = Pin(14, Pin.OUT) # set GPIO14 to output to drive the clock
+ data = Pin(13, Pin.OUT) # set GPIO13 to output to drive the data
+ apa = APA102(clock, data, 8) # create APA102 driver on the clock and the data pin for 8 pixels
+ apa[0] = (255, 255, 255, 31) # set the first pixel to white with a maximum brightness of 31
+ apa.write() # write data to all pixels
+ r, g, b, brightness = apa[0] # get first pixel colour
+
+For low-level driving of an APA102::
+
+ import esp
+ esp.apa102_write(clock_pin, data_pin, rgbi_buf)
+
WebREPL (web browser interactive prompt)
----------------------------------------