Guest User

max7219 bug repro

a guest
Mar 19th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import max7219.led as led
  4. import time
  5. from random import randrange
  6.  
  7. device = led.matrix(cascaded=1)
  8. device.orientation(180)
  9. device.brightness(1)
  10.  
  11. while True:
  12.     for x in range(500):
  13.         device.pixel(4, 4, 1, redraw=False)
  14.         direction = randrange(8)
  15.         if direction == 7 or direction == 0 or direction == 1:
  16.             device.scroll_up(redraw=False)
  17.         if direction == 1 or direction == 2 or direction == 3:
  18.             device.scroll_right(redraw=False)
  19.         if direction == 3 or direction == 4 or direction == 5:
  20.             device.scroll_down(redraw=False)
  21.         if direction == 5 or direction == 6 or direction == 7:
  22.             device.scroll_left(redraw=False)
  23.  
  24.         device.flush()
  25.         time.sleep(0.05)
Advertisement
Add Comment
Please, Sign In to add comment