Skip to content
Golang drivers for TSL2591 lux sensor
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/tsl2591
README.md
tsl2591.go

README.md

This is a Golang driver for the TSL2591 lux sensor.

Installation

go get -u github.com/mstahl/tsl2591

Usage

import "github.com/mstahl/tsl2591"

For now, tsl2591 only supports retrieving luminosity data, so no interrupts or alerts yet.

	tsl, err := tsl2591.NewTSL2591(&tsl2591.Opts{
		Gain:   tsl2591.TSL2591_GAIN_LOW,
		Timing: tsl2591.TSL2591_INTEGRATIONTIME_600MS,
	})
	if err != nil {
		panic(err)
	}

	ticker := time.NewTicker(1*time.Second)

	for {
		channel0, channel1 := tsl.GetFullLuminosity()
		log.Printf("0x%04x 0x%04x\n", channel0, channel1)
		<-ticker.C
	}

Acknowledgements

This library is basically a golang port of Adafruit's TSL2591 library

You can’t perform that action at this time.