-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathled_blinkers.py
32 lines (23 loc) · 1.05 KB
/
led_blinkers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from side_blinkers import SideBlinkers
from Blinker import Blinker
from state import MonitoredState
class LedBlinkers(SideBlinkers):
def __init__(self, robot) -> None:
self.robot = robot
def left_off_state_generator(self):
state = MonitoredState()
state.add_in_state_action(lambda: robot.led_off(1))
return state
def right_off_state_generator(self):
state = MonitoredState()
state.add_in_state_action(lambda: robot.led_off(0))
return state
def left_on_state_generator(self):
state = MonitoredState()
state.add_in_state_action(lambda: robot.led_on(1))
return state
def right_on_state_generator(self):
state = MonitoredState()
state.add_in_state_action(lambda: robot.led_on(0))
return state
super().__init__(left_off_state_generator, left_on_state_generator, right_off_state_generator, right_on_state_generator)