From bafceb110ad78c08d3751d96e61e98ff1612003d Mon Sep 17 00:00:00 2001 From: Hel Gibbons <50950368+helgibbons@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:53:58 +0100 Subject: [PATCH] Update Pico Unicorn readme --- micropython/modules/pico_unicorn/README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/micropython/modules/pico_unicorn/README.md b/micropython/modules/pico_unicorn/README.md index af5ca85a..0aa764dc 100644 --- a/micropython/modules/pico_unicorn/README.md +++ b/micropython/modules/pico_unicorn/README.md @@ -2,7 +2,7 @@ Our Pico Unicorn Pack offers 7x17 bright RGB LEDs driven by Pico's PIO. -We've included helper functions to handle every aspect of drawing to the display and interfacing with the buttons. See the [function reference](#function-reference) for details. +We've included helper functions for lighting up the LEDs and interfacing with the buttons. See the [function reference](#function-reference) for details. - [Example Program](#example-program) - [Function Reference](#function-reference) @@ -11,10 +11,11 @@ We've included helper functions to handle every aspect of drawing to the display - [set_pixel_value](#set_pixel_value) - [is_pressed](#is_pressed) - [get_width / get_height](#get_width--get_height) + - [clear](#clear) ## Example Program -The following example sets up Pico Unicorn, displays some basic demo text and graphics and will illuminate the RGB LED green if the A button is presse +The following example sets up Pico Unicorn, displays a rainbow across the LEDs and turns them all off when a button is pressed. ```python import math @@ -61,9 +62,7 @@ while not picounicorn.is_pressed(picounicorn.BUTTON_A): # Wait for Button A to pass # Clear the display -for x in range(w): - for y in range(h): - picounicorn.set_pixel(x, y, 0, 0, 0) +picounicorn.clear() print("Button A pressed!") ``` @@ -122,3 +121,11 @@ height = picounicorn.get_height() ``` This is useful where you're looping through the rows and columns to display a pattern- such as a rainbow using `hsv_to_rgb`. + +### clear + +Turn off all the LEDs: +```python +picounicorn.clear() +``` +