1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-29 13:49:14 +08:00

32 lines
455 B
Go
Raw Normal View History

package main
import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/audio"
)
func main() {
gbot := gobot.NewMaster()
e := audio.NewAdaptor()
laser := audio.NewDriver(e, "./examples/laser.mp3")
work := func() {
gobot.Every(2*time.Second, func() {
laser.Play()
})
}
robot := gobot.NewRobot("soundBot",
[]gobot.Connection{e},
[]gobot.Device{laser},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}