mlx90615

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2019 License: MIT Imports: 5 Imported by: 0

README

= go-mlx90615
janreggie

image:https://goreportcard.com/badge/github.com/janreggie/go-mlx90615["Go Report Card", link="https://goreportcard.com/report/github.com/janreggie/go-mlx90615"]
image:https://travis-ci.com/janreggie/go-mlx90615.svg?branch=master["Build Status", link="https://travis-ci.com/janreggie/go-mlx90615"]
image:https://godoc.org/github.com/janreggie/go-mlx90615?status.svg["GoDoc reference", link="https://godoc.org/github.com/janreggie/go-mlx90615"]
image:https://img.shields.io/github/license/janreggie/go-mlx90615.svg["GitHub", link="LICENSE"]

This library allows the reading of temperatures from the MLX90615
using Go on the Raspberry Pi.
This uses the link:https://godoc.org/periph.io/x/periph/conn/i2c[periph.io/x/periph/conn/i2c]
I2C-bus library.

This is based on link:https://github.com/zerynth/lib-melexis-mlx90615[zerynth/lib-melexis-mlx90615],
link:https://github.com/2n3906/python-sensor-drivers[2n3906/python-sensor-drivers], and
link:https://github.com/skiselev/MLX90615[skiselev/MLX90615].

== Sample usage
[source,go]
----
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)
    }
}
----

== License
See link:LICENSE[]

Documentation

Overview

Package mlx90615 implements reading of the MLX90615 sensor using Go.

Index

Constants

View Source
const (
	RegisterAmbient    = 0x26
	RegisterObject     = 0x27
	RegisterEmissivity = 0x13
)

Appropriate registers for the MLX90615

Variables

This section is empty.

Functions

This section is empty.

Types

type MLX90615

type MLX90615 struct {
	// contains filtered or unexported fields
}

MLX90615 is the sensor itself

func NewMLX90615

func NewMLX90615(addr uint8, bus int) (*MLX90615, error)

NewMLX90615 returns new sensor instance

func (*MLX90615) ReadAmbientTemperature

func (mlx *MLX90615) ReadAmbientTemperature() (temp float64, err error)

ReadAmbientTemperature returns the ambient temperature and an error value

func (*MLX90615) ReadEmissivity

func (mlx *MLX90615) ReadEmissivity() (emissivity float64, err error)

ReadEmissivity reads the emissivity of the MLX90615. Emissivity is a positive float no more than 1.00.

func (*MLX90615) ReadObjectTemperature

func (mlx *MLX90615) ReadObjectTemperature() (temp float64, err error)

ReadObjectTemperature returns the object temperature and an error value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL