From 5eeba138a48b27accf118270c18b21a7632a92c0 Mon Sep 17 00:00:00 2001 From: sago35 Date: Fri, 3 May 2024 10:31:39 +0900 Subject: [PATCH] Simplify examples/ws2812 --- examples/ws2812/arduino.go | 3 +-- examples/ws2812/digispark.go | 1 - examples/ws2812/main.go | 8 ++++---- examples/ws2812/others.go | 5 ++--- examples/ws2812/others_wo_led.go | 10 ---------- examples/ws2812/thingplus-rp2040.go | 12 ------------ 6 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 examples/ws2812/others_wo_led.go delete mode 100644 examples/ws2812/thingplus-rp2040.go diff --git a/examples/ws2812/arduino.go b/examples/ws2812/arduino.go index 3f8c58e..a47b104 100644 --- a/examples/ws2812/arduino.go +++ b/examples/ws2812/arduino.go @@ -4,7 +4,6 @@ package main import "machine" -// Replace neo and led in the code below to match the pin +// Replace neo in the code below to match the pin // that you are using if different. var neo = machine.D2 -var led = machine.LED diff --git a/examples/ws2812/digispark.go b/examples/ws2812/digispark.go index fa8c574..ad7f371 100644 --- a/examples/ws2812/digispark.go +++ b/examples/ws2812/digispark.go @@ -8,4 +8,3 @@ import "machine" // Replace neo and led in the code below to match the pin // that you are using if different. var neo machine.Pin = 0 -var led = machine.LED diff --git a/examples/ws2812/main.go b/examples/ws2812/main.go index 02699d6..60e1962 100644 --- a/examples/ws2812/main.go +++ b/examples/ws2812/main.go @@ -12,11 +12,12 @@ import ( "tinygo.org/x/drivers/ws2812" ) -var leds [10]color.RGBA +var ( + noe machine.Pin + leds [10]color.RGBA +) func main() { - led.Configure(machine.PinConfig{Mode: machine.PinOutput}) - neo.Configure(machine.PinConfig{Mode: machine.PinOutput}) ws := ws2812.NewWS2812(neo) @@ -35,7 +36,6 @@ func main() { } ws.WriteColors(leds[:]) - led.Set(rg) time.Sleep(100 * time.Millisecond) } } diff --git a/examples/ws2812/others.go b/examples/ws2812/others.go index 3c90f05..11becd8 100644 --- a/examples/ws2812/others.go +++ b/examples/ws2812/others.go @@ -1,10 +1,9 @@ -//go:build !digispark && !arduino && !qtpy && !m5stamp_c3 && !thingplus_rp2040 +//go:build !digispark && !arduino package main import "machine" -// Replace neo and led in the code below to match the pin +// Replace neo in the code below to match the pin // that you are using if different. var neo machine.Pin = machine.WS2812 -var led = machine.LED diff --git a/examples/ws2812/others_wo_led.go b/examples/ws2812/others_wo_led.go deleted file mode 100644 index 988d79a..0000000 --- a/examples/ws2812/others_wo_led.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build qtpy || m5stamp_c3 - -package main - -import "machine" - -// Replace neo and led in the code below to match the pin -// that you are using if different. -var neo machine.Pin = machine.WS2812 -var led = machine.NoPin diff --git a/examples/ws2812/thingplus-rp2040.go b/examples/ws2812/thingplus-rp2040.go deleted file mode 100644 index a194bda..0000000 --- a/examples/ws2812/thingplus-rp2040.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build thingplus_rp2040 - -package main - -import "machine" - -// This is the pin assignment for the internal neopixel of the -// Sparkfun thingplus rp2040. -// Replace neo and led in the code below to match the pin -// that you are using if different. -var neo machine.Pin = machine.GPIO8 -var led = machine.LED