8000 GitHub - wintwoo/max31855: A driver for the max31855 thermocouple breakout in Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wintwoo/max31855

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MAX31855 driver for Go

Usage

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())
}

About

A driver for the max31855 thermocouple breakout in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0