From d18a337558be31644f36dc16b5543eb1a38874fb Mon Sep 17 00:00:00 2001 From: JohnTrunix Date: Sun, 27 Aug 2023 12:56:42 +0200 Subject: [PATCH] perf(as7262): remove fmt library from example for arduino uno compatibility --- examples/as7262/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/as7262/main.go b/examples/as7262/main.go index 9db18d1f0..f623b750c 100644 --- a/examples/as7262/main.go +++ b/examples/as7262/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "machine" "time" "tinygo.org/x/drivers/as7262" @@ -13,20 +12,21 @@ var ( ) func main() { - i2c.Configure(machine.I2CConfig{Frequency: machine.TWI_FREQ_100KHZ}) sensor.Configure() if sensor.Connected() { + colorNames := [6]string{"Violet", "Blue", "Green", "Yellow", "Orange", "Red"} for { // read sensor colors (will read all 6 colors) colors := sensor.ReadColors() - fmt.Printf("Colors: %v", colors) - time.Sleep(time.Second) + for i, c := range colors { + println(colorNames[i], ": ", c) + } // read sensor temperature temp := sensor.ReadTemp() - fmt.Printf("Temperature: %d", temp) + println("Temperature: ", temp) time.Sleep(time.Second) } } else {