forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmata: correct problem where last analog pin(s) were being ignored …
…from capabilities query Signed-off-by: deadprogram <[email protected]>
- Loading branch information
1 parent
2d28e0a
commit d2e6c53
Showing
3 changed files
with
41 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// +build example | ||
// | ||
// Do not build by default. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"gobot.io/x/gobot" | ||
"gobot.io/x/gobot/drivers/aio" | ||
"gobot.io/x/gobot/platforms/firmata" | ||
) | ||
|
||
func main() { | ||
board := firmata.NewAdaptor(os.Args[1]) | ||
sensor := aio.NewGroveSoundSensorDriver(board, "3") | ||
|
||
work := func() { | ||
sensor.On(aio.Data, func(data interface{}) { | ||
fmt.Println("sensor", data) | ||
}) | ||
} | ||
|
||
robot := gobot.NewRobot("sensorBot", | ||
[]gobot.Connection{board}, | ||
[]gobot.Device{sensor}, | ||
work, | ||
) | ||
|
||
robot.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters