raspi-gpio example
Using googles periph
(peripherals in go) library to control a Raspberry Pi's
GPIO (General Purpose Input/Output) pins. The example used will be turning
on/off an external LED via a button.
Documents and references,
GitHub Webpage
PREREQUISITE
go get -u periph.io/x/periph/cmd/...
Will use include as,
"periph.io/x/periph/conn/gpio"
"periph.io/x/periph/conn/gpio/gpioreg"
"periph.io/x/periph/host"
I also created following group,
sudo groupadd gpio
sudo usermod -a -G gpio jeff
sudo grep gpio /etc/group
sudo chown root.gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem
GPIO TO BREADBOARD SCHEMATIC
We will control the LED via a button on the Raspberry Pi with
the following setup,
RUN
go run raspi-gpio.go