Gabel addiert
This commit is contained in:
parent
756a382af3
commit
ee76b97d83
2 changed files with 19 additions and 3 deletions
|
@ -12,7 +12,7 @@ damit man dann später auch wieder Code Completion hat bei Nutzung der Variablen
|
|||
'''
|
||||
class IQRobot:
|
||||
|
||||
def __init__(self, hub: PrimeHub, leftMotorPort: str, rightMotorPort: str, colorSensorPort: str, stickMotorPort: str):
|
||||
def __init__(self, hub: PrimeHub, leftMotorPort: str, rightMotorPort: str, colorSensorPort: str, stickMotorPort: str, gabelMotorPort: str):
|
||||
self.hub: PrimeHub = hub
|
||||
self.leftMotor: Motor = Motor(leftMotorPort)
|
||||
self.rightMotor: Motor = Motor(rightMotorPort)
|
||||
|
@ -67,4 +67,9 @@ class IQRobot:
|
|||
#Bewege sanft und langsam die Schleuderstange am hinteren Rumpf des Geräts
|
||||
self.stickMotor.run_for_degrees(degrees)
|
||||
|
||||
print("Loading library IQRobot in version " + VERSION)
|
||||
def moveGabel(self,degrees) :
|
||||
#Bewege sanft und langsam die Schleuderstange am hinteren Rumpf des Geräts
|
||||
self.gabelMotor.run_for_degrees(degrees)
|
||||
|
||||
|
||||
print("Loading library IQRobot in version " + VERSION)
|
13
main.py
13
main.py
|
@ -60,13 +60,15 @@ COLOR_SENSOR_PORT = 'E'
|
|||
LEFT_MOTOR_PORT = 'A'
|
||||
RIGHT_MOTOR_PORT = 'B'
|
||||
STICK_MOTOR_PORT = 'C'
|
||||
GABEL_MOTOR_PORT = 'D'
|
||||
|
||||
# Initialisieren des Hubs, der Aktoren und Sensoren
|
||||
hub = PrimeHub()
|
||||
|
||||
# Initialisiere Robot Klasse mit unseren Funktionen
|
||||
iqRobot: iq.IQRobot = iq.IQRobot(hub, LEFT_MOTOR_PORT, RIGHT_MOTOR_PORT, COLOR_SENSOR_PORT, STICK_MOTOR_PORT)
|
||||
iqRobot: iq.IQRobot = iq.IQRobot(hub, LEFT_MOTOR_PORT, RIGHT_MOTOR_PORT, COLOR_SENSOR_PORT, STICK_MOTOR_PORT, GABEL_MOTOR_PORT)
|
||||
|
||||
'''
|
||||
while(True):
|
||||
print('DIE FARBE IST ', iqRobot.colorSensor.get_color())
|
||||
if (iqRobot.colorSensor.get_color() == "cyan"):
|
||||
|
@ -77,4 +79,13 @@ while(True):
|
|||
print('Rot du Affe')
|
||||
else:
|
||||
print('Keine Farbe!')
|
||||
'''
|
||||
|
||||
iqRobot.moveGabel(50)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue