particle: update examples to take key params via command line
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
85127c5f49
commit
8e10ea30d7
|
@ -1,6 +1,14 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_api.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -13,7 +21,7 @@ func main() {
|
|||
master := gobot.NewMaster()
|
||||
api.NewAPI(master).Start()
|
||||
|
||||
core := particle.NewAdaptor("device_id", "access_token")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
led := gpio.NewLedDriver(core, "D7")
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_blink.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -9,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("device_id", "access_token")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
led := gpio.NewLedDriver(core, "D7")
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_button.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/drivers/gpio"
|
||||
"gobot.io/x/gobot/platforms/particle"
|
||||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("device_id", "access_token")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
led := gpio.NewLedDriver(core, "D7")
|
||||
button := gpio.NewButtonDriver(core, "D5")
|
||||
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_events.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/platforms/particle"
|
||||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
|
||||
work := func() {
|
||||
if stream, err := core.EventStream("all", ""); err != nil {
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_function.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/platforms/particle"
|
||||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
|
||||
work := func() {
|
||||
if result, err := core.Function("brew", "202,230"); err != nil {
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_led_brightness.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -9,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("device_id", "access_token")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
led := gpio.NewLedDriver(core, "A1")
|
||||
|
||||
work := func() {
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
/*
|
||||
To run this example, pass the device ID as first param,
|
||||
and the access token as the second param:
|
||||
|
||||
go run examples/particle_variable.go mydevice myaccesstoken
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gobot.io/x/gobot"
|
||||
|
@ -9,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
core := particle.NewAdaptor("DEVICE_ID", "ACCESS_TOKEN")
|
||||
core := particle.NewAdaptor(os.Args[1], os.Args[2])
|
||||
|
||||
work := func() {
|
||||
gobot.Every(1*time.Second, func() {
|
||||
|
|
Loading…
Reference in New Issue