Skip to content

Commit

Permalink
Added simple example for DRV2605L on C.H.I.P
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Agsjö <[email protected]>
  • Loading branch information
erkkah committed Feb 21, 2017
1 parent 9b04254 commit a144fd6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/chip_drv2605l.go
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit a144fd6

Please sign in to comment.