tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/l293x/simple/main.go (about)

     1  package main
     2  
     3  import (
     4  	"machine"
     5  	"time"
     6  
     7  	"tinygo.org/x/drivers/l293x"
     8  )
     9  
    10  func main() {
    11  	wheel := l293x.New(machine.D10, machine.D11, machine.D12)
    12  	wheel.Configure()
    13  
    14  	for i := 0; i <= 10; i++ {
    15  		println("Forward")
    16  		wheel.Forward()
    17  		time.Sleep(time.Millisecond * 1000)
    18  
    19  		println("Stop")
    20  		wheel.Stop()
    21  		time.Sleep(time.Millisecond * 1000)
    22  
    23  		println("Backward")
    24  		wheel.Backward()
    25  		time.Sleep(time.Millisecond * 1000)
    26  
    27  		println("Stop")
    28  		wheel.Stop()
    29  		time.Sleep(time.Millisecond * 1000)
    30  	}
    31  
    32  	println("Stop")
    33  	wheel.Stop()
    34  }