Added simple example for DRV2605L on C.H.I.P
Signed-off-by: Erik Agsjö <erik.agsjo@gmail.com>
This commit is contained in:
parent
9b0425480d
commit
a144fd6ebe
|
@ -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()
|
||||
}
|
Loading…
Reference in New Issue