testcode, to test engineclass
This commit is contained in:
parent
f739f34f75
commit
8dc6be6cfc
@ -6,8 +6,17 @@
|
||||
# The code is designed to work with the Raspberry Pi 5.
|
||||
######################################################################
|
||||
from gpiozero import Motor, PWMOutputDevice
|
||||
from time import sleep
|
||||
|
||||
|
||||
class Motor:
|
||||
def __init__(self, motor_pin1, motor_pin2, pwm_pin):
|
||||
pass
|
||||
|
||||
def forward(self, speed):
|
||||
pass
|
||||
|
||||
def backward(self, speed):
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
@ -2,9 +2,28 @@
|
||||
# This file contains the main code to control the robot.
|
||||
#
|
||||
####################################################################
|
||||
from motors import Motor
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
leftMotor = Motor(17, 18, 22)
|
||||
rightMotor = Motor(23, 24, 25)
|
||||
|
||||
while True:
|
||||
# Move forward
|
||||
leftMotor.forward(50)
|
||||
rightMotor.forward(50)
|
||||
|
||||
# Move backward
|
||||
wait(10)
|
||||
leftMotor.backward(50)
|
||||
rightMotor.backward(50)
|
||||
|
||||
# Stop
|
||||
leftMotor.stop()
|
||||
rightMotor.stop()
|
||||
wait(50)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
x
Reference in New Issue
Block a user