From bb5f06ffef86379060ff5a6e515378bc343dc31e Mon Sep 17 00:00:00 2001 From: Odin Grav Date: Wed, 17 Sep 2025 09:11:06 +0200 Subject: [PATCH] =?UTF-8?q?started=20=C3=A5=20f=C3=A5=20robotten=20til=20?= =?UTF-8?q?=C3=A5=20f=C3=B8lge=20en=20linje?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oving_3/main.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/oving_3/main.py b/oving_3/main.py index e4b38bf..937fbff 100644 --- a/oving_3/main.py +++ b/oving_3/main.py @@ -39,7 +39,19 @@ leftMotor = Motor(port=Port.A) rightMotor = Motor(port=Port.B) - robotDriveBase = DriveBase(leftMotor, rightMotor, wheel_diameter=56, axle_track=110) -robotDriveBase.drive(1000, 0) \ No newline at end of file +startBtn = TouchSensor(port=Port.S1) +usSensor = UltrasonicSensor(port=Port.S3) + +leftColorSensor = ColorSensor(port=Port.S2) +rightColorSensor = ColorSensor(port=Port.S4) + +while True: + if leftColorSensor.color() == Color.BLACK: + robotDriveBase.turn(5) + + elif rightColorSensor.color() == Color.BLACK: + robotDriveBase.turn(-5) + + DriveBase.run(100) \ No newline at end of file