Skip to content
/ rpigpio Public

Go library for interfacing with the Raspberry Pi GPIO hardware

License

Notifications You must be signed in to change notification settings

smo921/rpigpio

Repository files navigation

RpiGpio

RpiGpio is a Go package for interacting with the GPIO pins. This package is heavily influenced by the Python RPi.GPIO module and Stian Eilkland's go-rpio package.

Example Code

This example demonstrates how to toggle an output pin from high to low

package main

import (
	"time"

	"github.com/smo921/rpigpio"
)

func main() {
	gpio, _ := rpigpio.NewGPIO()
	gpio.Direction(7, rpigpio.OUT)

	for x := 0; x < 10; x++ {
		gpio.Write(7, rpigpio.HIGH)
		time.Sleep(time.Second)
		gpio.Write(7, rpigpio.LOW)
		time.Sleep(time.Second)
	}

}

References

Raspberry Pi hardware

GPIO

About

Go library for interfacing with the Raspberry Pi GPIO hardware

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published