Skip to content

Commit

Permalink
perf(as7262): remove fmt library from example for arduino uno compati…
Browse files Browse the repository at this point in the history
…bility
  • Loading branch information
JohnTrunix committed Aug 27, 2023
1 parent e37293c commit d18a337
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/as7262/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"machine"
"time"
"tinygo.org/x/drivers/as7262"
Expand All @@ -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 {
Expand Down

0 comments on commit d18a337

Please sign in to comment.