MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / handle_blinkers

Function handle_blinkers

Software/Scratch/GoPiGo3Scratch.py:735–764  ·  view source on GitHub ↗

set left/right/both blinkers on/off

(regObj)

Source from the content-addressed store, hash-verified

733
734
735def handle_blinkers(regObj):
736 '''
737 set left/right/both blinkers on/off
738 '''
739 # print("handle blinkers {}".format(regObj.group(BLINKER_STATUS_GROUP)))
740 try:
741 if regObj.group(BLINKER_SELECTION_GROUP) == "ledl":
742 left = True
743 right = False
744 elif regObj.group(BLINKER_SELECTION_GROUP) == "ledr":
745 right = True
746 left = False
747 else:
748 left = True if regObj.group(BLINKER_RIGHT_GROUP) == None else False
749 right = True if regObj.group(BLINKER_LEFT_GROUP) == None else False
750
751 if regObj.group(BLINKER_STATUS_GROUP) == "on" or \
752 regObj.group(BLINKER_STATUS_GROUP) == "255":
753 if right:
754 gpg.blinker_on("right")
755 if left:
756 gpg.blinker_on("left")
757 else:
758 if right:
759 gpg.blinker_off("right")
760 if left:
761 gpg.blinker_off("left")
762 except Exception as e:
763 print("handle_blinkers: {}".format(e))
764 return None
765
766
767def handle_eye_color(regObj):

Callers 1

handle_GoPiGo3_msgFunction · 0.85

Calls 2

blinker_onMethod · 0.80
blinker_offMethod · 0.80

Tested by

no test coverage detected