From bb0e6b8ba8305aad8742a40902cb7dad225bafb7 Mon Sep 17 00:00:00 2001 From: sago35 Date: Sat, 4 May 2024 23:32:27 +0900 Subject: [PATCH] Fix typo and move initialization of neo to init() --- examples/ws2812/arduino.go | 8 +++++--- examples/ws2812/digispark.go | 10 ++++++---- examples/ws2812/main.go | 2 +- examples/ws2812/others.go | 8 +++++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/examples/ws2812/arduino.go b/examples/ws2812/arduino.go index a47b104..6196aec 100644 --- a/examples/ws2812/arduino.go +++ b/examples/ws2812/arduino.go @@ -4,6 +4,8 @@ package main import "machine" -// Replace neo in the code below to match the pin -// that you are using if different. -var neo = machine.D2 +func init() { + // Replace neo in the code below to match the pin + // that you are using if different. + neo = machine.D2 +} diff --git a/examples/ws2812/digispark.go b/examples/ws2812/digispark.go index ad7f371..e7d7526 100644 --- a/examples/ws2812/digispark.go +++ b/examples/ws2812/digispark.go @@ -4,7 +4,9 @@ package main import "machine" -// This is the pin assignment for the Digispark only. -// Replace neo and led in the code below to match the pin -// that you are using if different. -var neo machine.Pin = 0 +func init() { + // This is the pin assignment for the Digispark only. + // Replace neo and led in the code below to match the pin + // that you are using if different. + neo = machine.Pin(0) +} diff --git a/examples/ws2812/main.go b/examples/ws2812/main.go index 60e1962..8ade21f 100644 --- a/examples/ws2812/main.go +++ b/examples/ws2812/main.go @@ -13,7 +13,7 @@ import ( ) var ( - noe machine.Pin + neo machine.Pin leds [10]color.RGBA ) diff --git a/examples/ws2812/others.go b/examples/ws2812/others.go index 11becd8..27e116e 100644 --- a/examples/ws2812/others.go +++ b/examples/ws2812/others.go @@ -4,6 +4,8 @@ package main import "machine" -// Replace neo in the code below to match the pin -// that you are using if different. -var neo machine.Pin = machine.WS2812 +func init() { + // Replace neo in the code below to match the pin + // that you are using if different. + neo = machine.WS2812 +}