-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiniMoto_Example.py
More file actions
executable file
·47 lines (40 loc) · 964 Bytes
/
MiniMoto_Example.py
File metadata and controls
executable file
·47 lines (40 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
# Copyright 2014 Herman Liu , Geekroo Technologies
#
#Example code demonstrating the use of the python Library for the MiniMoto Copper
#from Geekroo, which uses the DRV8830 IC for I2C low-voltage DC motor control.
#MOTO1 I2C Address
#SJ1=0(L)
#SJ1=0(L)
#WRITE=0xC0h
#READ=0xC1h
#MOTO2 I2C Address
#SJ3=0(L)
#SJ4=Open
#WRITE=0xC2h
#READ=0xC3h
from Raspi_MiniMoto_Driver import MOTO
import time
# ===========================================================================
# Example Code
# ===========================================================================
# Initialise the MiniMoto
motor1 = MOTO(0x60)
motor2 = MOTO(0x65)
while (1):
print "Forward Speed=40!"
motor1.drive(40)
motor2.drive(40)
time.sleep(3)
print "Stop!"
motor1.stop()
motor2.stop()
time.sleep(2)
print "Reverse Speed=-40!"
motor1.drive(-40)
motor2.drive(-40)
time.sleep(3)
print "Brake!"
motor1.brake()
motor2.brake()
time.sleep(2)