/
SmartMTk.py
44 lines (33 loc) · 931 Bytes
/
SmartMTk.py
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
from MotorDriver import MotorDriver
class SmartMTk:
"""This class manage an RC monstrer truck powered by a RaspberryPI
"""
def __init__(self):
"""SmartMTk class constructor
"""
# Init motors
self.motors = MotorDriver(22,27,17,24,23,18,25)
def forward(self):
"""Move forward the monster truck
"""
self.motors.a_forward(100)
def backward(self):
"""Move backward the monster truck
"""
self.motors.a_backward(100)
def shortBrake(self):
"""Short brake
"""
self.motors.a_shortBrake()
def turnRight(self):
"""Turn the wheels to the right
"""
self.motors.b_forward(100)
def turnLeft(self):
"""Move forward the monster truck
"""
self.motors.b_backward(100)
def straight(self):
"""Go straight
"""
self.motors.b_stop()