docs: update Raspi to latest info

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2016-12-19 16:45:03 +01:00
parent 04db4ddd9f
commit 20659c0a96
1 changed files with 44 additions and 49 deletions

View File

@ -1,4 +1,4 @@
# Raspi
# Raspberry Pi
The Raspberry Pi is an inexpensive and popular ARM based single board computer with digital & PWM GPIO, and i2c interfaces built in.
@ -8,60 +8,14 @@ For more info about the Raspberry Pi platform, click [here](http://www.raspberry
## How to Install
First you must install the appropriate Go packages
```
go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/raspi
```
### Enabling PWM output on GPIO pins.
You need to install and have pi-blaster running in the raspberry-pi, you can follow the instructions for pi-blaster install in the pi-blaster repo here:
[https://github.com/sarfata/pi-blaster](https://github.com/sarfata/pi-blaster)
### Special note for Raspian Wheezy users
The go vesion installed from the default package repositories is very old and will not compile gobot. You can install go 1.4 as follows:
```bash
$ wget -O - http://dave.cheney.net/paste/go1.4.linux-arm~multiarch-armv6-1.tar.gz|sudo tar -xzC /usr/local -f -
$ echo '# Setup for golang' |sudo tee /etc/profile.d/golang.sh
$ echo 'PATH=$PATH:/usr/local/go/bin'|sudo tee -a /etc/profile.d/golang.sh
$ source /etc/profile.d/golang.sh
```
#### Cross compiling for the Raspberry Pi
You must first configure your Go environment for linux cross compiling
```bash
$ cd $GOROOT/src
$ GOOS=linux GOARCH=arm ./make.bash --no-clean
```
Then compile your Gobot program with
```bash
$ GOARM=6 GOARCH=arm GOOS=linux examples/raspi_blink.go
```
Then you can simply upload your program over the network from your host computer to the Raspi
```bash
$ scp raspi_blink pi@192.168.1.xxx:/home/pi/
```
and execute it on your Raspberry Pi with
```bash
$ ./raspi_blink
```
## How to Use
The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.
```go
package main
@ -92,3 +46,44 @@ func main() {
robot.Start()
}
```
## How to Connect
### Compiling
Simply compile your Gobot program like this:
```bash
$ GOARM=6 GOARCH=arm GOOS=linux examples/raspi_blink.go
```
Then you can simply upload your program over the network from your host computer to the Raspi
```bash
$ scp raspi_blink pi@192.168.1.xxx:/home/pi/
```
and execute it on your Raspberry Pi with
```bash
$ ./raspi_blink
```
### Enabling PWM output on GPIO pins.
For extended PWM support on the Raspberry Pi, you will need to use a program called pi-blaster. You can follow the instructions for pi-blaster install in the pi-blaster repo here:
[https://github.com/sarfata/pi-blaster](https://github.com/sarfata/pi-blaster)
### Special note for Raspian Wheezy users
The Golang version installed from the default package repositories is very old and will not compile Gobot. You can install go 1.4 as follows:
```bash
$ wget -O - http://dave.cheney.net/paste/go1.4.linux-arm~multiarch-armv6-1.tar.gz|sudo tar -xzC /usr/local -f -
$ echo '# Setup for golang' |sudo tee /etc/profile.d/golang.sh
$ echo 'PATH=$PATH:/usr/local/go/bin'|sudo tee -a /etc/profile.d/golang.sh
$ source /etc/profile.d/golang.sh
```