@@ -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 ):
0 commit comments