From 57950413ca142230a69809c02d002f6cff70af10 Mon Sep 17 00:00:00 2001 From: Tobias Tangemann Date: Fri, 30 Dec 2016 07:03:13 +0100 Subject: [PATCH] Fix and extend sample in apa102 module docu (#1689) --- docs/en/modules/apa102.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/en/modules/apa102.md b/docs/en/modules/apa102.md index b6567995..5122e5e6 100644 --- a/docs/en/modules/apa102.md +++ b/docs/en/modules/apa102.md @@ -30,12 +30,18 @@ Send ABGR data in 8 bits to a APA102 chain. #### Returns `nil` -#### Example +#### Example 1 ```lua a = 31 b = 0 g = 0 r = 255 -led_abgr = string.char(a, b, g, r, a, b, g, r) +leds_abgr = string.char(a, b, g, r, a, b, g, r) apa102.write(2, 3, leds_abgr) -- turn two APA102s to red, connected to data_pin 2 and clock_pin 3 ``` + +#### Example 2 +```lua +-- set the first 30 leds to red +apa102.write(2, 3, string.char(31, 255, 0, 0):rep(30)) +```