Skip to content

Commit

Permalink
Fixed docs and added example
Browse files Browse the repository at this point in the history
  • Loading branch information
thetooth committed Feb 23, 2017
1 parent a957de9 commit 1cc9cc9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
32 changes: 32 additions & 0 deletions examples/dragonboard_button.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"fmt"

"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/dragonboard"
)

func main() {
dragonAdaptor := chip.NewAdaptor()
button := gpio.NewButtonDriver(dragonAdaptor, "GPIO_A")

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,
)

robot.Start()
}
18 changes: 9 additions & 9 deletions platforms/dragonboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The [DragonBoard 410c](http://www.96boards.org/product/dragonboard410c/), a product of Arrow Electronics, is the development board based on the mid-tier Qualcomm® Snapdragon™ 410E processor. It features advanced processing power, Wi-Fi, Bluetooth connectivity, and GPS, all packed into a board the size of a credit card.

Make sure you are using the latest linaro debian image.
Make sure you are using the latest Linaro Debian image. Both AArch32 and AArch64 work™ though you should stick to 64bit as OS internals may be different and aren't tested.

## How to Install
```
Expand All @@ -11,7 +11,7 @@ go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/drago

## How to Use

The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.
The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself. See [here](https://www.96boards.org/db410c-getting-started/HardwareDocs/HWUserManual.md/).

```go
package main
Expand All @@ -21,12 +21,12 @@ import (

"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/chip"
"gobot.io/x/gobot/platforms/dragonboard"
)

func main() {
chipAdaptor := chip.NewAdaptor()
button := gpio.NewButtonDriver(chipAdaptor, "XIO-P0")
dragonAdaptor := chip.NewAdaptor()
button := gpio.NewButtonDriver(dragonAdaptor, "GPIO_A")

work := func() {
gobot.On(button.Event("push"), func(data interface{}) {
Expand Down Expand Up @@ -55,12 +55,12 @@ func main() {
Compile your Gobot program like this:

```bash
$ GOARCH=arm64 GOOS=linux go build examples/chip_button.go
$ GOARCH=arm64 GOOS=linux go build examples/dragon_button.go
```

Then you can simply upload your program to the CHIP and execute it with
Then you can simply upload your program to the board and execute it with

```bash
$ scp chip_button [email protected]:
$ ssh -t [email protected] "./chip_button"
$ scp dragon_button [email protected]:
$ ssh -t [email protected] "./dragon_button"
```

0 comments on commit 1cc9cc9

Please sign in to comment.