diff --git a/examples/spark_core_api.go b/examples/spark_core_api.go index d30386f2..707051f5 100644 --- a/examples/spark_core_api.go +++ b/examples/spark_core_api.go @@ -10,11 +10,10 @@ import ( func main() { master := gobot.NewGobot() - api.Api(master).Start() + api.NewApi(master).Start() sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") - - led := gpio.NewLed(sparkCore, "led", "D7") + led := gpio.NewLedDriver(sparkCore, "led", "D7") work := func() { gobot.Every(1*time.Second, func() { diff --git a/examples/spark_core_blink.go b/examples/spark_core_blink.go index d92b918e..c9f098aa 100644 --- a/examples/spark_core_blink.go +++ b/examples/spark_core_blink.go @@ -11,7 +11,7 @@ func main() { master := gobot.NewGobot() sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") - led := gpio.NewLed(sparkCore, "led", "D7") + led := gpio.NewLedDriver(sparkCore, "led", "D7") work := func() { gobot.Every(1*time.Second, func() { diff --git a/examples/spark_core_button.go b/examples/spark_core_button.go index 8b3329d5..64f38508 100644 --- a/examples/spark_core_button.go +++ b/examples/spark_core_button.go @@ -4,15 +4,14 @@ import ( "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/gpio" "github.com/hybridgroup/gobot/platforms/spark" - "time" ) func main() { master := gobot.NewGobot() sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") - led := gpio.NewLed(sparkCore, "led", "D7") - button := gpio.NewButton(sparkCore, "button", "D5") + led := gpio.NewLedDriver(sparkCore, "led", "D7") + button := gpio.NewButtonDriver(sparkCore, "button", "D5") work := func() { gobot.On(button.Events["push"], func(data interface{}) { diff --git a/examples/spark_core_led_brithgness.go b/examples/spark_core_led_brithgness.go index c61b9520..6d92dc7c 100644 --- a/examples/spark_core_led_brithgness.go +++ b/examples/spark_core_led_brithgness.go @@ -11,13 +11,13 @@ func main() { master := gobot.NewGobot() sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") - led := gpio.NewLed(sparkCore, "led", "A1") + led := gpio.NewLedDriver(sparkCore, "led", "A1") work := func() { brightness := uint8(0) - fade_amount := uint8(15) + fade_amount := uint8(25) - gobot.Every(0.5*time.Second, func() { + gobot.Every(500*time.Millisecond, func() { led.Brightness(brightness) brightness = brightness + fade_amount if brightness == 0 || brightness == 255 {