2016-01-30 02:00:27 -08:00
# CHIP
The [CHIP ](http://www.getchip.com/ ) is a small, inexpensive ARM based single board computer, with many different IO interfaces available on the [pin headers ](http://docs.getchip.com/#pin-headers ).
2016-12-19 16:33:04 +01:00
We recommend updating to the latest Debian OS when using the C.H.I.P., however Gobot should also support older versions of the OS, should your application require this.
2016-01-30 02:00:27 -08:00
For documentation about the CHIP platform click [here ](http://docs.getchip.com/ ).
## How to Install
```
2016-12-08 13:24:03 +01:00
go get -d -u gobot.io/x/gobot/... & & go install gobot.io/x/gobot/platforms/chip
2016-01-30 02:00:27 -08:00
```
## How to Use
2016-12-19 16:33:04 +01:00
The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.
2016-01-30 02:00:27 -08:00
```go
package main
import (
"fmt"
2016-12-08 13:24:03 +01:00
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/chip"
2016-01-30 02:00:27 -08:00
)
func main() {
2016-09-25 20:19:19 +02:00
chipAdaptor := chip.NewAdaptor()
button := gpio.NewButtonDriver(chipAdaptor, "XIO-P0")
2016-01-30 02:00:27 -08:00
work := func() {
gobot.On(button.Event("push"), func(data interface{}) {
fmt.Println("button pressed")
})
gobot.On(button.Event("release"), func(data interface{}) {
fmt.Println("button released")
})
}
robot := gobot.NewRobot("buttonBot",
[]gobot.Connection{chipAdaptor},
[]gobot.Device{button},
work,
)
2016-10-18 21:37:10 +02:00
robot.Start()
2016-01-30 02:00:27 -08:00
}
```
2016-12-19 16:33:04 +01:00
## How to Connect
### Compiling
Compile your Gobot program like this:
```bash
$ GOARCH=arm GOOS=linux go build examples/chip_button.go
```
Then you can simply upload your program to the CHIP and execute it with
```bash
$ scp chip_button root@192 .168.1.xx:
$ ssh -t root@192 .168.1.xx "./chip_button"
```