forked from hybridgroup/gobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
46 lines (33 loc) · 903 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Package spark provides the Gobot adaptor for the Spark Core.
Installing:
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/spark
Example:
package main
import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/gpio"
"github.com/hybridgroup/gobot/platforms/spark"
)
func main() {
gbot := gobot.NewGobot()
sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token")
led := gpio.NewLedDriver(sparkCore, "led", "D7")
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
robot := gobot.NewRobot("spark",
[]gobot.Connection{sparkCore},
[]gobot.Device{led},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}
For further information refer to spark readme:
https://github.com/hybridgroup/gobot/blob/master/platforms/spark/README.md
*/
package spark