Created
June 29, 2018 09:15
-
-
Save shyampurk/42a4156bdee512f53e8c023f1393d000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def updateTrafficSignal(): | |
global trafficLightNormalCurrState | |
state = emergencyVehicleState["state"] | |
if state == NORMAL: | |
if (LIGHT_RED == trafficLightNormalCurrState): | |
print "Switching to RED\n" | |
set_red() | |
elif (LIGHT_YELLOW == trafficLightNormalCurrState): | |
print "Switching to YELLOW\n" | |
set_yellow() | |
elif (LIGHT_GREEN == trafficLightNormalCurrState): | |
print "Switching to GREEN\n" | |
set_green() | |
time.sleep(trafficLightNormalCycleTime[trafficLightNormalCurrState]) | |
trafficLightNormalCurrState = trafficLightNormalCycle[ (trafficLightNormalCurrState + 1) % 3] | |
elif state == CRITICAL: | |
set_green() | |
print "Detected Critical Distance from Emergency Vehicle\n" | |
print "Switching to GREEN and Hold\n" | |
time.sleep(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment