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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. import util
  24. t = util.getTarget()
  25. # Loading fonts and graphics takes a while.
  26. # So show a splash screen while the user waits.
  27. splash = SplashScreen(t)
  28. t.loop_start()
  29. splash.draw()
  30. t.loop_end()
  31. # UbaBot is online
  32. success = Manager(t)
  33. success.add(ScrollText(t, "Visit UbaBot Cocktail machine at FruBar village for drinks!", "bitmap8", 1, 10, camp_green))
  34. success.add(Solid(t, 1.0))
  35. success.add(QRScreen(t, qr_data, 30.0, "Drinks", "bitmap6", camp_pink, (0, 0, 0)))
  36. success.add(Solid(t, 1.0))
  37. # UbaBot is offline
  38. fail = Manager(t)
  39. fail.add(ScrollText(t, "#CCCAMP23", "bitmap8", 1, 10, camp_green))
  40. fail.add(Solid(t, 1.0))
  41. fail.add(ScrollText(t, "The UbaBot Cocktail machine is closed. Please come back later!", "bitmap8", 1, 10, camp_green))
  42. fail.add(Solid(t, 1.0))
  43. fail.add(GameOfLife(t, 20, (0, 255, 0), (0, 0, 0), None, 2.0))
  44. fail.add(Solid(t, 1.0))
  45. 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, 10, camp_green))
  46. fail.add(Solid(t, 1.0))
  47. # UbaBot status checker
  48. d = CheckHTTP(url)
  49. d.success(success)
  50. d.fail(fail)
  51. # Main "Menu"
  52. m = Manager(t)
  53. m.add(QRScreen(t, img_data, 15.0))
  54. m.add(Solid(t, 1.0))
  55. m.add(d) # HTTP Check, either "success" or "fail"
  56. m.add(Solid(t, 1.0))
  57. m.add(PicoBatt(t, 5.0, 5.0))
  58. m.add(Solid(t, 1.0))
  59. m.restart()
  60. util.loop(t, m.draw)