Skip to content

Commit

Permalink
started å få robotten til å følge en linje
Browse files Browse the repository at this point in the history
  • Loading branch information
Odin Grav committed Sep 17, 2025
1 parent a664d67 commit bb5f06f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions oving_3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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)

0 comments on commit bb5f06f

Please sign in to comment.