From 51a4f8aa5f619f4dcfc827c16c91c77dd947a062 Mon Sep 17 00:00:00 2001 From: Gabe Date: Wed, 27 Sep 2017 15:49:51 -0400 Subject: [PATCH 1/4] Updating neopixel.rst to reflect the changes made in pull #2536 --- docs/esp8266/tutorial/neopixel.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/esp8266/tutorial/neopixel.rst b/docs/esp8266/tutorial/neopixel.rst index 245aed6d4609e..4e60a3bdd5188 100644 --- a/docs/esp8266/tutorial/neopixel.rst +++ b/docs/esp8266/tutorial/neopixel.rst @@ -14,6 +14,11 @@ To create a NeoPixel object do the following:: This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the "4" (pin number) and the "8" (number of pixel) to suit your set up. +For LEDs with more than 3 colors, 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) + To set the colour of pixels use:: >>> np[0] = (255, 0, 0) # set to red, full brightness From ab0897735c2d9b7cf049dc92e71463eebe1b27cc Mon Sep 17 00:00:00 2001 From: Gabe Date: Mon, 2 Oct 2017 11:13:38 -0400 Subject: [PATCH 2/4] Manual Line Wrapping Changes --- docs/esp8266/tutorial/neopixel.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/esp8266/tutorial/neopixel.rst b/docs/esp8266/tutorial/neopixel.rst index 4e60a3bdd5188..23b7a4ca820b9 100644 --- a/docs/esp8266/tutorial/neopixel.rst +++ b/docs/esp8266/tutorial/neopixel.rst @@ -11,10 +11,12 @@ To create a NeoPixel object do the following:: >>> import machine, neopixel >>> np = neopixel.NeoPixel(machine.Pin(4), 8) -This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the +This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the "4" (pin number) and the "8" (number of pixel) to suit your set up. -For LEDs with more than 3 colors, 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:: +For LEDs with more than 3 colors, 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) From fc1622bc1ff182094aa3aff4979f2115a52e9cc3 Mon Sep 17 00:00:00 2001 From: Gabe Date: Mon, 2 Oct 2017 11:13:52 -0400 Subject: [PATCH 3/4] Update neopixel.rst --- docs/esp8266/tutorial/neopixel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/esp8266/tutorial/neopixel.rst b/docs/esp8266/tutorial/neopixel.rst index 23b7a4ca820b9..abdedde12a4c7 100644 --- a/docs/esp8266/tutorial/neopixel.rst +++ b/docs/esp8266/tutorial/neopixel.rst @@ -11,7 +11,7 @@ To create a NeoPixel object do the following:: >>> import machine, neopixel >>> np = neopixel.NeoPixel(machine.Pin(4), 8) -This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the +This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the "4" (pin number) and the "8" (number of pixel) to suit your set up. For LEDs with more than 3 colors, such as RGBW pixels or RGBY pixels, the From a8f808379063152da5d278185ca23088a0df1170 Mon Sep 17 00:00:00 2001 From: Gabe Date: Tue, 3 Oct 2017 15:26:31 -0400 Subject: [PATCH 4/4] Updating neopixel.rst Added example of using 4-tuples and did some slight reordering. --- docs/esp8266/tutorial/neopixel.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/esp8266/tutorial/neopixel.rst b/docs/esp8266/tutorial/neopixel.rst index abdedde12a4c7..e3d89f1c4c43d 100644 --- a/docs/esp8266/tutorial/neopixel.rst +++ b/docs/esp8266/tutorial/neopixel.rst @@ -14,18 +14,25 @@ To create a NeoPixel object do the following:: This configures a NeoPixel strip on GPIO4 with 8 pixels. You can adjust the "4" (pin number) and the "8" (number of pixel) to suit your set up. +To set the colour of pixels use:: + + >>> np[0] = (255, 0, 0) # set to red, full brightness + >>> 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 colors, 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 color. +For example to set the first three pixels use:: -To set the colour of pixels use:: - - >>> np[0] = (255, 0, 0) # set to red, full brightness - >>> np[1] = (0, 128, 0) # set to green, half brightness - >>> np[2] = (0, 0, 64) # set to blue, quarter brightness + >>> 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::