def main(): """ A remote control that is programmed to control the light in button 0 and the garage door in the button 6 """ print("Initialization of the remote") remote = Remote() print(remote) # Programming button 1 to control lights light = Light() light_command = LightCommand(light) remote.set_command(0, light_command) print(remote) # Programming button 1 to control garage door garage_door = GarageDoor() garage_command = GarageDoorCommand(garage_door) remote.set_command(6, garage_command) print(remote) print("Testing possible actions") remote.press_on(0) remote.press_off(0) remote.press_on(6) remote.press_off(6) remote.press_on(1) remote.press_off(1)
def main(): remote = Remote() lights = Lights() lights_on_command = LightsOnCommand(lights) lights_off_command = LightsOffCommand(lights) remote.set_command(lights_on_command) remote.pressButton() remote.set_command(lights_off_command) remote.pressButton()