Created
July 3, 2019 14:50
-
-
Save robinmanuelthiel/3045965b8aa0d234379f26cfd7b60c39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
from time import sleep | |
from RpiMotorLib import RpiMotorLib | |
from multiprocessing import Process | |
def rotateMotor(motor, pins, isClockwise): | |
motor.motor_run(pins, .001, 128, isClockwise, False, "half", .05); | |
def open(motorLeft, pinsLeft, motorRight, PinsRight): | |
leftMotorProcess = Process(target=rotateMotor,args=(motorLeft,pinsleft,False,)); | |
rightMotorProcess = Process(target=rotateMotor,args=(motorRight,pinsRight,True,)); | |
leftMotorProcess.start(); | |
rightMotorProcess.start(); | |
leftMotorProcess.join(); | |
rightMotorProcess.join(); | |
def close(motorLeft, pinsLeft, motorRight, PinsRight): | |
leftMotorProcess = Process(target=rotateMotor,args=(motorLeft,pinsleft,True,)); | |
rightMotorProcess = Process(target=rotateMotor,args=(motorRight,pinsRight,False,)); | |
leftMotorProcess.start(); | |
rightMotorProcess.start(); | |
leftMotorProcess.join(); | |
rightMotorProcess.join(); | |
# Left Motor | |
pinsleft = [21, 26, 20, 19]; | |
motorLeft = RpiMotorLib.BYJMotor("MotorLeft", "28BYJ"); | |
# Right Motors | |
pinsRight = [16, 13, 12, 6]; | |
motorRight = RpiMotorLib.BYJMotor("MotorRIght", "28BYJ"); | |
open(motorLeft, pinsleft, motorRight, pinsRight); | |
sleep(.5); | |
close(motorLeft, pinsleft, motorRight, pinsRight); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment