https://github.com/jrcichra/gophidgets
Golang bindings for the Phidgets C library
https://github.com/jrcichra/gophidgets
c golang golang-wrapper hacktoberfest phidgets
Last synced: 3 months ago
JSON representation
Golang bindings for the Phidgets C library
- Host: GitHub
- URL: https://github.com/jrcichra/gophidgets
- Owner: jrcichra
- License: mit
- Created: 2020-01-19T18:11:03.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-11T00:39:20.000Z (5 months ago)
- Last Synced: 2025-03-26T00:51:23.619Z (3 months ago)
- Topics: c, golang, golang-wrapper, hacktoberfest, phidgets
- Language: Go
- Homepage:
- Size: 1.06 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gophidgets [](https://goreportcard.com/report/github.com/jrcichra/gophidgets)
Golang bindings for the Phidgets C library
# Changelog
- 2025/02/10 - Changed `GetSonarReflections()` to only return `distance` and `amplitude` 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 called `getVoltage()`, not `getSensorValue()`. I broke out the functions to match the Phidget's library names since `VoltageInput` and `VoltageRatioInput` are used in different ways based on the hardware.## Install
`go get "github.com/jrcichra/gophidgets/phidgets"`
## Example
```go
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)
}
```