1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
Javier Cervantes 3d454a7b05 Updating pebble with new structure
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
2014-06-10 13:11:27 -05:00

33 lines
810 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() {
pebbleDriver.SendNotification("Hello Pebble!")
gobot.On(pebbleDriver.Events["button"], func(data interface{}) {
fmt.Println("Button pushed: " + data.(string))
})
gobot.On(pebbleDriver.Events["tap"], func(data interface{}) {
fmt.Println("Tap event detected")
})
}
robot := gobot.NewRobot("pebble", []gobot.Connection{pebbleAdaptor}, []gobot.Device{pebbleDriver}, work)
master.Robots = append(master.Robots, robot)
master.Start()
}