https://github.com/raspberrypi-go-drivers/led
Driver allowing to control a LED from GPIO pins
https://github.com/raspberrypi-go-drivers/led
driver go golang raspberrypi raspberrypi-drivers robotics
Last synced: 4 months ago
JSON representation
Driver allowing to control a LED from GPIO pins
- Host: GitHub
- URL: https://github.com/raspberrypi-go-drivers/led
- Owner: raspberrypi-go-drivers
- License: mit
- Created: 2020-12-18T15:53:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-18T16:14:35.000Z (over 5 years ago)
- Last Synced: 2025-06-16T09:01:05.791Z (12 months ago)
- Topics: driver, go, golang, raspberrypi, raspberrypi-drivers, robotics
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LED
[](https://pkg.go.dev/github.com/raspberrypi-go-drivers/led)

[](https://goreportcard.com/report/github.com/raspberrypi-go-drivers/led)
[](https://opensource.org/licenses/MIT)
This drivers allows interact with a LED connected to a GPIO pin
## Documentation
For full documentation, please visit [](https://pkg.go.dev/github.com/raspberrypi-go-drivers/led)
## Quick start
```go
import (
"fmt"
"time"
"github.com/raspberrypi-go-drivers/led"
"github.com/stianeikeland/go-rpio/v4"
)
func main() {
err := rpio.Open()
if err != nil {
os.Exit(1)
}
defer rpio.Close()
l1 := led.NewLED(18)
for {
l1.Toggle()
time.Sleep(1 * time.Second)
state, _ := l1.GetState()
fmt.Println(state)
}
}
```
## Raspberry Pi compatibility
This driver has has only been tested on an Raspberry Pi Zero WH using integrated bluetooth but may work well on other Raspberry Pi having integrated Bluetooth
## License
MIT License
---
Special thanks to @stianeikeland
This driver is based on his work in [stianeikeland/go-rpio](https://github.com/stianeikeland/go-rpio/)