Skip to content

Commit c78bdbf

Browse files
Mark Shannondpgeorge
authored andcommitted
Modify led_dance to use new display API.
1 parent 1a4ebae commit c78bdbf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/led_dance.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313

1414
def led_dance(delay):
1515
dots = [ [0]*5, [0]*5, [0]*5, [0]*5, [0]*5 ]
16-
microbit.display.set_display_mode(1)
1716
while True:
18-
dots[microbit.random(5)][microbit.random(5)] = 128
17+
dots[microbit.random(5)][microbit.random(5)] = 8
1918
for i in range(5):
2019
for j in range(5):
21-
microbit.display.image.set_pixel(i, j, dots[i][j])
22-
dots[i][j] = int(dots[i][j]/2)
20+
microbit.display.set_pixel(i, j, dots[i][j])
21+
dots[i][j] = max(dots[i][j] - 1, 0)
2322
microbit.sleep(delay)
2423

2524
led_dance(100)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy