Skip to content

Commit eb67647

Browse files
committed
LineStop works; will stop at places like rivers on the board. Starting Linefollow. Added MenuLib for menu system later.
1 parent f7646ab commit eb67647

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

FLLMaster/DriveLibraries.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ def LineStop(self, Heading, Speed, Stop):
375375
# Check and store the sign of the input speed for PID correction
376376
sign = Speed / abs(Speed)
377377

378+
# Set the color sensor to "Color" mode
379+
self.cs._ensure_mode(self.cs.MODE_COL_COLOR)
380+
378381
# Set the brick light to solid amber
379382
#EV3.SetLEDColor("ORANGE", "NORMAL")
380383

@@ -403,11 +406,13 @@ def LineStop(self, Heading, Speed, Stop):
403406
self.steer.on(-turn_native_units, (Speed))
404407

405408
# Check if the sensor is seeing white
406-
if self.correctedRLI >= 95:
407-
self.spkr.beep(play_type=1)
409+
color = self.cs.color
410+
if color == self.cs.COLOR_WHITE:
408411
seenWhite = True
409-
elif (self.correctedRLI <= 10) and seenWhite:
412+
elif (color == self.cs.COLOR_BLACK) and seenWhite:
410413
end = True
414+
elif color == self.cs.COLOR_BLUE:
415+
seenWhite = seenWhite
411416
else:
412417
seenWhite = False
413418

@@ -416,4 +421,6 @@ def LineStop(self, Heading, Speed, Stop):
416421
self.steer.stop()
417422

418423
# Set the brick light back to green flashing
419-
#EVS.SetLEDColor("GREEN", "PULSE")
424+
#EVS.SetLEDColor("GREEN", "PULSE")
425+
426+
def LineFollow(self, Speed, Stop):

FLLMaster/Main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
R1.gs.calibrate()
77
sleep(1)
88
R1.spkr.beep()
9-
R1.reflectCal()
9+
R1.btn.wait_for_bump('enter')
10+
R1.cs.calibrate_white()
1011
R1.btn.wait_for_bump('enter')
1112
# Write Code Here ----------------------------------------
12-
R1.LineStop(0, 50, True)
13-
13+
while True:
14+
R1.zeroGyro()
15+
R1.LineStop(0, 75, True)
16+
R1.btn.wait_for_bump('enter')
1417

FLLMaster/MenuLib.py

Whitespace-only changes.

0 commit comments

Comments
 (0)