periph

Peripherals I/O in Go

News

2018-10-14 Announcing v3.2.0: Change pin functionality; measure light; run on MIPS
2018-07-31 Announcing v3.1.0: Now with capacitive sensing
2018-06-27 Announcing v3.0.0: Leveraging past learnings for the future
2018-05-26 Announcing v2.3.0: physic and FastRead()
2018-05-13 Power drive your Raspi: Drive and slew limiting are now configurable
2018-05-03 Announcing v2.2.0: BeagleBone and more!
See all 12 news entry...

boardimage

Overview

periph.io/x/periph is a standalone hardware library with no external dependency. It can be viewed as a lower level layer than Gobot and, yes, we’re discussing to collaborate in the future!

Features

Platforms

Devices

Tools

periph includes many ready-to-use tools:

go get periph.io/x/periph/cmd/...
# List the host drivers registered and/or initialized:
periph-info
# List the board headers:
headers-list
# List the state of each GPIO:
gpio-list
# Set P1_7/GPIO4 on a Raspberry Pi to high:
gpio-write P1_7 1

Library

periph tries hard to get out of the way when used as a library.

GoDoc

Here’s the minimal “toggle a LED” example:

package main

import (
    "time"
    "periph.io/x/periph/conn/gpio"
    "periph.io/x/periph/conn/gpio/gpioreg"
    "periph.io/x/periph/host"
)

func main() {
    host.Init()
    p := gpioreg.ByName("11")
    t := time.NewTicker(500 * time.Millisecond)
    for l := gpio.Low; ; l = !l {
        p.Out(l)
        <-t.C
    }
}

Learn more about GPIOs.

boardimage

More infos

Contact

Authors

periph was initiated with ❤️️ and passion by Marc-Antoine Ruel. The full list of contributors is in AUTHORS and CONTRIBUTORS.

Disclaimer

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

This project is not affiliated with the Go project.