Skip to content

The traffic light created here aims to achieve energy efficiency both during the day and at night, reducing traffic congestion, and being environmentally friendly.

License

Notifications You must be signed in to change notification settings

TRIOARGE/Day-Night_Lamp_Control

 
 

Repository files navigation

Day-Night_Lamp_Control

The traffic light created here aims to achieve energy efficiency both during the day and at night, reducing traffic congestion, and being environmentally friendly.

import time

def traffic_light_mode(hour): # Day mode: 06:00 - 22:00 a.m # Night mode: 22:00 - 06:00 p.m if 6 <= hour < 22: return "Day" else: return "Night"

def traffic_light_mode(hour): if mod == "Day": print("GREEN light 5 seconds") time.sleep(5) # wait 5 seconds print("YELLOW light 2 seconds") time.sleep(2) # wait 2 seconds print("RED light 5 seconds") time.sleep(5) # wait 5 seconds else: # night mode print("YELLOW light flashing, 2 seconds") time.sleep(2) # wait 2 seconds

x usage

Manual input

hour = int(input("Please enter current time (0-23): "))

Set the mood according to the time of day

mod = traffic_light_mode(hour):

Check the traffic light

traffic_heat_control(mode)

// We can transform this control system, which can also be done with PLC programming, into a more understandable system using the Phyton software language.//

About

The traffic light created here aims to achieve energy efficiency both during the day and at night, reducing traffic congestion, and being environmentally friendly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published