package main
import (
"fmt"
"log"
"github.com/lukechannings/max31855"
"periph.io/x/periph/conn/spi/spireg"
"periph.io/x/periph/host"
)
func main() {
if _, err := host.Init(); err != nil {
log.Fatal(err)
}
s, err := spireg.Open("")
if err != nil {
log.Fatal("Couldn't open SPI port! " + err.Error())
}
dev, err := max31855.New(s)
if err != nil {
log.Fatal("Couldn't open device! " + err.Error())
}
temp, err := dev.GetTemp()
if err != nil {
fmt.Println(err.Error())
}
fmt.Printf("Current temperature: %v °C (%v °F)", temp.Thermocouple.Celsius(), temp.Thermocouple.Fahrenheit())
}
forked from LukeChannings/max31855
-
Notifications
You must be signed in to change notification settings - Fork 0
A driver for the max31855 thermocouple breakout in Go
License
wintwoo/max31855
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A driver for the max31855 thermocouple breakout in Go
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Go 100.0%