Two ChoiceΒΆ
Wait for a choice between ports 1 and 2. Indicate the choice for 1 second with the chosen port LED at max intensity.
1from bpod_core.fsm import StateMachine
2
3fsm = StateMachine()
4
5fsm.add_state(
6 name='WaitForChoice',
7 transitions={'Port1_High': 'LightPort1', 'Port2_High': 'LightPort2'},
8)
9fsm.add_state(
10 name='LightPort1',
11 timer=1,
12 transitions={'Tup': '>exit'},
13 actions={'PWM1': 255},
14)
15fsm.add_state(
16 name='LightPort2',
17 timer=1,
18 transitions={'Tup': '>exit'},
19 actions={'PWM2': 255},
20)
1{
2 "states": {
3 "WaitForChoice": {
4 "transitions": {
5 "Port1_High": "LightPort1",
6 "Port2_High": "LightPort2"
7 }
8 },
9 "LightPort1": {
10 "timer": 1.0,
11 "transitions": {
12 "Tup": ">exit"
13 },
14 "actions": {
15 "PWM1": 255
16 }
17 },
18 "LightPort2": {
19 "timer": 1.0,
20 "transitions": {
21 "Tup": ">exit"
22 },
23 "actions": {
24 "PWM2": 255
25 }
26 }
27 }
28}
1states:
2 WaitForChoice:
3 transitions:
4 Port1_High: LightPort1
5 Port2_High: LightPort2
6 LightPort1:
7 timer: 1.0
8 transitions:
9 Tup: '>exit'
10 actions:
11 PWM1: 255
12 LightPort2:
13 timer: 1.0
14 transitions:
15 Tup: '>exit'
16 actions:
17 PWM2: 255