Golang bindings for the Phidgets C library
- 2025/02/10 - Changed
GetSonarReflections()
to only returndistance
andamplitude
slices. The count is not required as Go makes it simple to determine. A check was added to validate the lengths are the same. - 2022/11/24 - VoltageInput and VoltageInputRatio
GetValue()
always calledgetVoltage()
, notgetSensorValue()
. I broke out the functions to match the Phidget's library names sinceVoltageInput
andVoltageRatioInput
are used in different ways based on the hardware.
go get "github.com/jrcichra/gophidgets/phidgets"
t := phidgets.PhidgetTemperatureSensor{}
t.Create()
t.SetIsRemote(true)
t.SetDeviceSerialNumber(11111)
t.SetHubPort(0)
err = t.OpenWaitForAttachment(2 * time.Second)
if err != nil {
panic(err)
}
//Loop forever
for {
fmt.Println("Temperature is", t.GetValue()*9.0/5.0+32)
time.Sleep(time.Duration(5) * time.Second)
}