This library allows the reading of temperatures from the MLX90615 using Go on the Raspberry Pi. This uses the periph.io/x/periph/conn/i2c I2C-bus library.
This is based on zerynth/lib-melexis-mlx90615, 2n3906/python-sensor-drivers, and skiselev/MLX90615.
package main
import (
"log"
"github.com/janreggie/go-mlx90615"
)
func main() {
mlxObj, err := mlx90615.NewMLX90615(0x5B, 1)
if err != nil {
log.Fatalln("NewMLX90615 error: ", err)
}
if ambientTemp, err := mlxObj.ReadAmbientTemperature(); err != nil {
log.Fatalln("Can't read ambient temperature: ", err)
} else {
log.Println("Ambient temperature is ", ambientTemp)
}
if objectTemp, err := mlxObj.ReadObjectTemperature(); err != nil {
log.Fatalln("Can't read object temperature: ", err)
} else {
log.Println("Object temperature is ", objectTemp)
}
if emissivity, err := mlxObj.ReadEmissivity(); err != nil {
log.Fatalln("Can't read emissivity: ", err)
} else {
log.Println("Emissivity is ", emissivity)
}
}
See LICENSE