From a55bd56f0c25f90ea1c5b0c161e7e2df4c182a74 Mon Sep 17 00:00:00 2001 From: vilenne Date: Wed, 1 Mar 2023 17:38:39 +0100 Subject: [PATCH] =?UTF-8?q?methode=20move=20stick=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iqrobot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/iqrobot.py b/iqrobot.py index 4a93360..55cda1a 100644 --- a/iqrobot.py +++ b/iqrobot.py @@ -11,13 +11,13 @@ 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): + def __init__(self, hub: PrimeHub, leftMotorPort: str, rightMotorPort: str, colorSensorPort: str, stickMotorPort: str): self.hub: PrimeHub = hub self.leftMotor: Motor = Motor(leftMotorPort) self.rightMotor: Motor = Motor(rightMotorPort) self.movementMotors: MotorPair = MotorPair(leftMotorPort, rightMotorPort) self.colorSensor: ColorSensor = ColorSensor(colorSensorPort) - + self.stickMotor: Motor = Motor(stickMotorPort) def show(self, image: str): ''' @@ -40,6 +40,7 @@ class IQRobot: def main(self): + self.moveStick(30) if self.colorSensor.get_reflected_light() > 1: self.show('ANGRY') else: @@ -49,8 +50,12 @@ class IQRobot: colorIntensity = self.getColorIntensity() print("Farbintensität: " + str(colorIntensity)) - + def moveStick(self,degrees) : + #Bewege sanft und langsam die Schleuderstange am hinteren Rumpf des Geräts + self.stickMotor.run_for_degrees(degrees) print("successfully loaded the IQ Lego teams code :)") + +