Files
2020-02-08 19:54:31 +01:00

27 lines
449 B
Go

// This example uses the settings for the thermistor that is built in to the
// Adafruit Circuit Playground Express.
package main
import (
"machine"
"time"
"tinygo.org/x/drivers/thermistor"
)
const ADC_PIN = machine.TEMPSENSOR
func main() {
machine.InitADC()
sensor := thermistor.New(ADC_PIN)
sensor.Configure()
for {
temp, _ := sensor.ReadTemperature()
println("Temperature:", temp/1000, "°C")
time.Sleep(2 * time.Second)
}
}