mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-02 22:17:49 +00:00
c6e8af3057
Signed-off-by: Ron Evans <ron@hybridgroup.com>
35 lines
535 B
Go
35 lines
535 B
Go
package main
|
|
|
|
import (
|
|
"machine"
|
|
"time"
|
|
|
|
"tinygo.org/x/drivers/l293x"
|
|
)
|
|
|
|
func main() {
|
|
wheel := l293x.New(machine.D10, machine.D11, machine.D12)
|
|
wheel.Configure()
|
|
|
|
for i := 0; i <= 10; i++ {
|
|
println("Forward")
|
|
wheel.Forward()
|
|
time.Sleep(time.Millisecond * 1000)
|
|
|
|
println("Stop")
|
|
wheel.Stop()
|
|
time.Sleep(time.Millisecond * 1000)
|
|
|
|
println("Backward")
|
|
wheel.Backward()
|
|
time.Sleep(time.Millisecond * 1000)
|
|
|
|
println("Stop")
|
|
wheel.Stop()
|
|
time.Sleep(time.Millisecond * 1000)
|
|
}
|
|
|
|
println("Stop")
|
|
wheel.Stop()
|
|
}
|