mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00

Movinf events creation to newPebbleDriver method Adding basic button support Ignoring sass-cache and robeaux Adding accelerometer example Adding tap support Use custom server instead of classic martini This is to disable logs and avoid noise Adding correct format to code Adding notification support to pebble driver Adding tests and correcting PendingMessage Updating documentation Format to example accel Removing logging changes in api Removing temp fix in api, will be attended later Removing extra space
28 lines
633 B
Go
28 lines
633 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/hybridgroup/gobot"
|
|
"github.com/hybridgroup/gobot/api"
|
|
"github.com/hybridgroup/gobot/platforms/pebble"
|
|
)
|
|
|
|
func main() {
|
|
master := gobot.NewGobot()
|
|
api.NewApi(master).Start()
|
|
|
|
pebbleAdaptor := pebble.NewPebbleAdaptor("pebble")
|
|
pebbleDriver := pebble.NewPebbleDriver(pebbleAdaptor, "pebble")
|
|
|
|
work := func() {
|
|
gobot.On(pebbleDriver.Events["accel"], func(data interface{}) {
|
|
fmt.Println(data.(string))
|
|
})
|
|
}
|
|
|
|
robot := gobot.NewRobot("pebble", []gobot.Connection{pebbleAdaptor}, []gobot.Device{pebbleDriver}, work)
|
|
|
|
master.Robots = append(master.Robots, robot)
|
|
master.Start()
|
|
}
|