File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def light_region(region, duration=1):
4141 cpx .pixels [led ] = REGION_COLOR [region ]
4242
4343 # play a tone for the selected region
44- cpx .start_tone (REGION_TONE [region ]);
44+ cpx .start_tone (REGION_TONE [region ])
4545
4646 # wait the requested amount of time
4747 time .sleep (duration )
@@ -54,22 +54,24 @@ def light_region(region, duration=1):
5454 cpx .pixels [led ] = (0 , 0 , 0 )
5555
5656def read_region (timeout = 30 ):
57+ val = 0
5758 start_time = time .time ()
5859 while time .time () - start_time < timeout :
5960 if cpx .touch_A1 :
60- return PAD_REGION ['A1' ]
61+ val = PAD_REGION ['A1' ]
6162 elif cpx .touch_A2 :
62- return PAD_REGION ['A2' ]
63+ val = PAD_REGION ['A2' ]
6364 elif cpx .touch_A3 :
64- return PAD_REGION ['A3' ]
65+ val = PAD_REGION ['A3' ]
6566 elif cpx .touch_A4 :
66- return PAD_REGION ['A4' ]
67+ val = PAD_REGION ['A4' ]
6768 elif cpx .touch_A5 :
68- return PAD_REGION ['A5' ]
69+ val = PAD_REGION ['A5' ]
6970 elif cpx .touch_A6 :
70- return PAD_REGION ['A6' ]
71+ val = PAD_REGION ['A6' ]
7172 elif cpx .touch_A7 :
72- return PAD_REGION ['A7' ]
73+ val = PAD_REGION ['A7' ]
74+ return val
7375
7476def play_sequence (sequence ):
7577 duration = 1 - len (sequence ) * 0.05
You can’t perform that action at this time.
0 commit comments