@@ -686,6 +686,13 @@ def __init__(self,
686
686
except :
687
687
raise ValueError ("Line Follower Library not found" )
688
688
689
+ # Needed for Bloxter
690
+ try :
691
+ from di_sensors import easy_line_follower
692
+ self ._lf = easy_line_follower .EasyLineFollower (port = port )
693
+ except :
694
+ self ._lf = None
695
+
689
696
self .use_mutex = use_mutex
690
697
691
698
def read_raw_sensors (self ):
@@ -821,6 +828,66 @@ def read_position_str(self):
821
828
out_str = "" .join (["b" if sensor_val == 1 else "w" for sensor_val in five_vals ])
822
829
return out_str
823
830
831
+ # Bloxter Support
832
+ def position_bw (self ):
833
+ """
834
+ This method is only here to support Bloxter and
835
+ fake di_sensors.easy_line_follower
836
+ """
837
+ try :
838
+ return self ._lf .position_bw ()
839
+ except ValueError as e :
840
+ print (e )
841
+ raise
842
+ except Exception as e :
843
+ print (e )
844
+ return - 1
845
+
846
+ def position_01 (self ):
847
+ """
848
+ This method is only here to support Bloxter and
849
+ fake di_sensors.easy_line_follower
850
+ """
851
+ try :
852
+ return self ._lf .position_01 ()
853
+ except :
854
+ return - 1
855
+
856
+ def position (self ):
857
+ """
858
+ This method is only here to support Bloxter and
859
+ fake di_sensors.easy_line_follower
860
+ """
861
+ try :
862
+ return self ._lf .position ()
863
+ except :
864
+ return - 1
865
+
866
+ def set_calibration (self , color ):
867
+ """
868
+ This method is only here to support Bloxter and
869
+ fake di_sensors.easy_line_follower
870
+ """
871
+ try :
872
+ return self ._lf .set_calibration (color )
873
+ except ValueError as e :
874
+ print (e )
875
+ except Exception as e :
876
+ print (e )
877
+ line_val = []
878
+
879
+ def get_calibration (self , color ):
880
+ """
881
+ This method is only here to support Bloxter and
882
+ fake di_sensors.easy_line_follower
883
+ """
884
+ try :
885
+ return self ._lf .get_calibration (color )
886
+ except ValueError as e :
887
+ print (e )
888
+ except Exception as e :
889
+ print (e )
890
+ line_val = []
824
891
825
892
#######################################################################
826
893
#
0 commit comments