summaryrefslogtreecommitdiffstatshomepage
path: root/docs/esp8266/tutorial/neopixel.rst
diff options
context:
space:
mode:
authorGabe <gmp@h4xmb.org>2017-09-27 15:49:51 -0400
committerDamien George <damien.p.george@gmail.com>2017-10-04 10:35:22 +1100
commit9e0cdb22f1a549d5e542418a3007c756cd594b84 (patch)
treee0df1785e268b94b1b6908a78425fd8a163f8231 /docs/esp8266/tutorial/neopixel.rst
parent3289b9b7a76a1230b6bb631e191a47bfc6c7a8ee (diff)
downloadmicropython-9e0cdb22f1a549d5e542418a3007c756cd594b84.tar.gz
micropython-9e0cdb22f1a549d5e542418a3007c756cd594b84.zip
docs/esp8266/tutorial: Update neopixel with example of using 4 bbp.
Diffstat (limited to 'docs/esp8266/tutorial/neopixel.rst')
-rw-r--r--docs/esp8266/tutorial/neopixel.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/esp8266/tutorial/neopixel.rst b/docs/esp8266/tutorial/neopixel.rst
index 245aed6d46..a1537526f3 100644
--- a/docs/esp8266/tutorial/neopixel.rst
+++ b/docs/esp8266/tutorial/neopixel.rst
@@ -20,6 +20,20 @@ To set the colour of pixels use::
>>> np[1] = (0, 128, 0) # set to green, half brightness
>>> np[2] = (0, 0, 64) # set to blue, quarter brightness
+For LEDs with more than 3 colours, such as RGBW pixels or RGBY pixels, the
+NeoPixel class takes a ``bpp`` parameter. To setup a NeoPixel object for an
+RGBW Pixel, do the following::
+
+ >>> import machine, neopixel
+ >>> np = neopixel.NeoPixel(machine.Pin(4), 8, bpp=4)
+
+In a 4-bpp mode, remember to use 4-tuples instead of 3-tuples to set the colour.
+For example to set the first three pixels use::
+
+ >>> np[0] = (255, 0, 0, 128) # Orange in an RGBY Setup
+ >>> np[1] = (0, 255, 0, 128) # Yellow-green in an RGBY Setup
+ >>> np[2] = (0, 0, 255, 128) # Green-blue in an RGBY Setup
+
Then use the ``write()`` method to output the colours to the LEDs::
>>> np.write()