Simplify examples/ws2812

This commit is contained in:
sago35
2024-05-03 10:31:39 +09:00
committed by Ron Evans
parent 1095629f62
commit 5eeba138a4
6 changed files with 7 additions and 32 deletions
+1 -2
View File
@@ -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
-1
View File
@@ -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
+4 -4
View File
@@ -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)
}
}
+2 -3
View File
@@ -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
-10
View File
@@ -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
-12
View File
@@ -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