Python RGB Matrix games and animations https://www.xythobuz.de/ledmatrix_v2.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

camp_pico.py 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/usr/bin/env python3
  2. # ----------------------------------------------------------------------------
  3. # "THE BEER-WARE LICENSE" (Revision 42):
  4. # <xythobuz@xythobuz.de> wrote this file. As long as you retain this notice
  5. # you can do whatever you want with this stuff. If we meet some day, and you
  6. # think this stuff is worth it, you can buy me a beer in return. Thomas Buck
  7. # ----------------------------------------------------------------------------
  8. camp_pink = (251, 72, 196)
  9. camp_green = (63, 255, 33)
  10. # pre-converted images for Pico (required libraries not available)
  11. from qr_tmp import qr_data
  12. from img_tmp import img_data
  13. from solid import Solid
  14. from life import GameOfLife
  15. from net import CheckHTTP
  16. from qr import QRScreen
  17. from scroll import ScrollText
  18. from splash import SplashScreen
  19. from manager import Manager
  20. from pico import PicoBatt
  21. #url = "http://ubabot.frubar.net"
  22. url = "http://www.xythobuz.de"
  23. scroll_speed = 10
  24. import util
  25. i = util.getInput()
  26. t = util.getTarget(i)
  27. # Loading fonts and graphics takes a while.
  28. # So show a splash screen while the user waits.
  29. splash = SplashScreen(t)
  30. t.loop_start()
  31. splash.draw()
  32. t.loop_end()
  33. # UbaBot is online
  34. success = Manager(t)
  35. success.add(ScrollText(t, "Visit UbaBot Cocktail machine at FruBar village for drinks!", "bitmap8", 1, scroll_speed, camp_green))
  36. success.add(Solid(t, 1.0))
  37. success.add(QRScreen(t, qr_data, 30.0, "Drinks", "bitmap6", camp_pink, (0, 0, 0)))
  38. success.add(Solid(t, 1.0))
  39. # UbaBot is offline
  40. fail = Manager(t)
  41. fail.add(ScrollText(t, "#CCCAMP23", "bitmap8", 1, scroll_speed, camp_green))
  42. fail.add(Solid(t, 1.0))
  43. fail.add(ScrollText(t, "The UbaBot Cocktail machine is closed. Please come back later!", "bitmap8", 1, scroll_speed, camp_green))
  44. fail.add(Solid(t, 1.0))
  45. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  46. fail.add(Solid(t, 1.0))
  47. fail.add(ScrollText(t, "Your advertisement could appear here. Open a Pull Request on git.xythobuz.de/thomas/rgb-matrix-visualizer or send an e-mail to thomas@xythobuz.de", "bitmap8", 1, scroll_speed, camp_green))
  48. fail.add(Solid(t, 1.0))
  49. # UbaBot status checker
  50. d = CheckHTTP(url)
  51. d.success(success)
  52. d.fail(fail)
  53. # Main "Menu"
  54. m = Manager(t, i)
  55. m.add(QRScreen(t, img_data, 15.0, None, None, (255, 255, 255), (0, 0, 0)))
  56. m.add(Solid(t, 1.0))
  57. m.add(d) # HTTP Check, either "success" or "fail"
  58. m.add(Solid(t, 1.0))
  59. m.add(ScrollText(t, "Need to print something? FruBar village has a 3D printer. Come by!", "bitmap8", 1, scroll_speed, camp_pink))
  60. m.add(Solid(t, 1.0))
  61. m.add(PicoBatt(t, 5.0, 5.0))
  62. m.add(Solid(t, 1.0))
  63. m.restart()
  64. util.loop(t, m.draw)