File tree Expand file tree Collapse file tree
Circuit_Playground_Brake_Light Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313i = 0
1414cp .pixels .fill ((255 , 0 , 0 ))
1515
16- sleep = False
16+ light_on = False
1717
1818while True :
1919 x , y , z = cp .acceleration
3838 if not cp .shake (shake_threshold = 10 ):
3939 cp .pixels .brightness = 1
4040 start = time .monotonic ()
41- sleep = True
41+ light_on = True
4242 i += 1
4343
44- # sleep variable is for short circuiting. Not really necessary, but it makes things run faster
45- elif not sleep or time .monotonic () - start > 0.4 :
44+ # light_on variable is for short circuiting. Not really necessary, but it makes things run faster
45+ elif not light_on or time .monotonic () - start > 0.4 :
4646 # Sine wave used for the color breathing effect.
4747 # Max brightness can be adjusted with the coefficient.
4848 cp .pixels .brightness = abs (math .sin (brightness )) * 0.5
4949 brightness += 0.05
5050 i = 0
51- sleep = False
51+ light_on = False
5252
5353 time .sleep (0.02 )
You can’t perform that action at this time.
0 commit comments