diff --git a/examples/chip_drv2605l.go b/examples/chip_drv2605l.go new file mode 100644 index 00000000..1c9add5c --- /dev/null +++ b/examples/chip_drv2605l.go @@ -0,0 +1,30 @@ +package main + +import ( + "time" + + "gobot.io/x/gobot" + "gobot.io/x/gobot/drivers/i2c" + "gobot.io/x/gobot/platforms/chip" +) + +func main() { + board := chip.NewAdaptor() + haptic := i2c.NewDRV2605LDriver(board) + + work := func() { + gobot.Every(3*time.Second, func() { + pause := haptic.GetPauseWaveform(50) + haptic.SetSequence([]byte{1, pause, 1, pause, 1}) + haptic.Go() + }) + } + + robot := gobot.NewRobot("DRV2605LBot", + []gobot.Connection{board}, + []gobot.Device{haptic}, + work, + ) + + robot.Start() +}