diff --git a/examples/beaglebone_blinkm.go b/examples/beaglebone_blinkm.go index 8a42a1f4..cc823824 100644 --- a/examples/beaglebone_blinkm.go +++ b/examples/beaglebone_blinkm.go @@ -14,7 +14,7 @@ func main() { blinkm := i2c.NewBlinkMDriver(beagleboneAdaptor) work := func() { - gobot.Every(3*time.Second, func() { + gobot.Every(1*time.Second, func() { r := byte(gobot.Rand(255)) g := byte(gobot.Rand(255)) b := byte(gobot.Rand(255)) diff --git a/examples/chip_blinkm.go b/examples/chip_blinkm.go new file mode 100644 index 00000000..6537a877 --- /dev/null +++ b/examples/chip_blinkm.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "time" + + "gobot.io/x/gobot" + "gobot.io/x/gobot/drivers/i2c" + "gobot.io/x/gobot/platforms/chip" +) + +func main() { + a := chip.NewAdaptor() + blinkm := i2c.NewBlinkMDriver(a) + + work := func() { + gobot.Every(1*time.Second, func() { + r := byte(gobot.Rand(255)) + g := byte(gobot.Rand(255)) + b := byte(gobot.Rand(255)) + blinkm.Rgb(r, g, b) + color, _ := blinkm.Color() + fmt.Println("color", color) + }) + } + + robot := gobot.NewRobot("blinkmBot", + []gobot.Connection{a}, + []gobot.Device{blinkm}, + work, + ) + + robot.Start() +} diff --git a/examples/raspi_blinkm.go b/examples/raspi_blinkm.go index 2b264555..31087361 100644 --- a/examples/raspi_blinkm.go +++ b/examples/raspi_blinkm.go @@ -14,7 +14,7 @@ func main() { blinkm := i2c.NewBlinkMDriver(r) work := func() { - gobot.Every(3*time.Second, func() { + gobot.Every(1*time.Second, func() { r := byte(gobot.Rand(255)) g := byte(gobot.Rand(255)) b := byte(gobot.Rand(255))