package main
import (
"fmt"
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/raspi"
)
func main() {
r := raspi.NewAdaptor()
stepper := gpio.NewStepperDriver(r, [4]string{"7", "11", "13", "15"}, gpio.StepperModes.DualPhaseStepping, 2048)
work := func() {
stepper.SetSpeed(15)
if err := stepper.Move(2048); err != nil {
fmt.Println(err)
}
if err := stepper.Move(-2048); err != nil {
fmt.Println(err)
}
}
robot := gobot.NewRobot("stepperBot",
[]gobot.Connection{r},
[]gobot.Device{stepper},
work,
)
robot.Start()
}