tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/easystepper/main.go (about) 1 package main 2 3 import ( 4 "machine" 5 "time" 6 7 "tinygo.org/x/drivers/easystepper" 8 ) 9 10 func main() { 11 config := easystepper.DeviceConfig{ 12 Pin1: machine.P13, Pin2: machine.P15, Pin3: machine.P14, Pin4: machine.P16, 13 StepCount: 200, RPM: 75, Mode: easystepper.ModeFour, 14 } 15 motor, _ := easystepper.New(config) 16 motor.Configure() 17 18 for { 19 println("CLOCKWISE") 20 motor.Move(2050) 21 time.Sleep(time.Millisecond * 1000) 22 23 println("COUNTERCLOCKWISE") 24 motor.Move(-2050) 25 time.Sleep(time.Millisecond * 1000) 26 } 27 }