How can I read the temperature sensor values on GPIO of a Raspberry Pi using the go language?
Please, anyone help me out.
Thanks in advance.
Check out Dave Cheney's package:
There's a classical blink example there.
Another is goPi - also has support for piface
And the blink examples
this is a slightly higher level abstraction than dave cheney's gpio library.
In addition to a gpio api, there is support for many common sensors
not sure what your sensor is, but e.g. here is an example for the bmp180 barometric sensor
I have created an extremely simple package for interacting with the GPIO pins on a Raspberry Pi:
https://github.com/nathan-osman/go-rpigpio
A simple program that makes pin 2 flash ten times would look something like this:
package main
import (
"github.com/nathan-osman/go-rpigpio"
"time"
)
func main() {
p, err := rpi.OpenPin(2, rpi.OUT)
if err != nil {
panic(err)
}
defer p.Close()
for i := 0; i < 10; i++ {
p.Write(rpi.HIGH)
time.Sleep(300 * time.Millisecond)
p.Write(rpi.LOW)
time.Sleep(100 * time.Millisecond)
}
}
More documentation can be found here.