l9110x: add support for L9110x h-bridge motor driver

Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
Ron Evans
2020-01-03 10:31:35 +01:00
committed by Daniel Esteban
parent c6e8af3057
commit d5aa295b76
5 changed files with 175 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
package main
import (
"machine"
"time"
"tinygo.org/x/drivers/l9110x"
)
func main() {
wheel := l9110x.New(machine.D10, machine.D11)
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()
}