-
Notifications
You must be signed in to change notification settings - Fork 0
/
SkiftBane.py
executable file
·30 lines (26 loc) · 956 Bytes
/
SkiftBane.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from Ligeud import Kør_Lige_ud , Kør_Lige_ud_Ind_TIL
from pybricks.tools import wait
def Skift_linje_Højre(DriveBase,sensor,grey):
DriveBase.turn(45)
DriveBase.straight(50)
print(grey)
while sensor.reflection() > grey:
print(sensor.reflection())
DriveBase.drive(200,0)
DriveBase.stop()
DriveBase.turn(-45)
def Skift_linje_Venstre(DriveBase,sensor,grey):
DriveBase.turn(-45)
DriveBase.straight(50)
print(grey)
while sensor.reflection() > grey:
print(sensor.reflection())
DriveBase.drive(200,0)
DriveBase.stop()
DriveBase.turn(45)
def FørsteSegment(robot,line_sensor,threshold,BLACK):
Kør_Lige_ud(robot,line_sensor,threshold,-4)
Skift_linje_Højre(robot,line_sensor,BLACK)
Kør_Lige_ud(robot,line_sensor,threshold,4)
Skift_linje_Venstre(robot,line_sensor,BLACK)
#Kør_Lige_ud_Ind_TIL(robot,line_sensor,threshold,-4, 4000)