1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00
hybridgroup.gobot/examples/chip_drv2605l.go
Thomas Kohler 865e724af0
Build(v2): revert move to v2 subfolder (#932)
* revert move to v2 subfolder
* fix CI and adjust CHANGELOG
2023-05-29 19:23:28 +02:00

37 lines
581 B
Go

//go:build example
// +build example
//
// Do not build by default.
package main
import (
"time"
"gobot.io/x/gobot/v2"
"gobot.io/x/gobot/v2/drivers/i2c"
"gobot.io/x/gobot/v2/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()
}