Skip to content

Commit 9eb5ea0

Browse files
committed
Changed sleep for light_on
1 parent 2f429c5 commit 9eb5ea0

File tree

1 file changed

+5
-5
lines changed
  • Circuit_Playground_Brake_Light

1 file changed

+5
-5
lines changed

Circuit_Playground_Brake_Light/code.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
i = 0
1414
cp.pixels.fill((255, 0, 0))
1515

16-
sleep = False
16+
light_on = False
1717

1818
while True:
1919
x, y, z = cp.acceleration
@@ -38,16 +38,16 @@
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)

0 commit comments

Comments
 (0)