Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

monitor.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/usr/bin/env python
  2. import signal
  3. import flicklib
  4. import time
  5. import sys
  6. #import curses
  7. #from curses import wrapper
  8. some_value = 5000
  9. @flicklib.move()
  10. def move(x, y, z):
  11. global xyztxt
  12. xyztxt = '{:5.3f} {:5.3f} {:5.3f}'.format(x,y,z)
  13. @flicklib.flick()
  14. def flick(start,finish):
  15. global flicktxt
  16. flicktxt = start + ' - ' + finish
  17. print(start + ' - ' + finish)
  18. sys.stdout.flush()
  19. @flicklib.airwheel()
  20. def spinny(delta):
  21. global some_value
  22. global airwheeltxt
  23. some_value += delta
  24. if some_value < 0:
  25. some_value = 0
  26. if some_value > 10000:
  27. some_value = 10000
  28. airwheeltxt = str(some_value/100)
  29. print (airwheeltxt)
  30. sys.stdout.flush()
  31. @flicklib.double_tap()
  32. def doubletap(position):
  33. global doubletaptxt
  34. doubletaptxt = position
  35. print(doubletaptxt)
  36. sys.stdout.flush()
  37. @flicklib.tap()
  38. def tap(position):
  39. global taptxt
  40. taptxt = position
  41. print(taptxt)
  42. sys.stdout.flush()
  43. @flicklib.touch()
  44. def touch(position):
  45. global touchtxt
  46. touchtxt = position
  47. print(touchtxt)
  48. sys.stdout.flush()
  49. #
  50. # Main display using curses
  51. #
  52. #def main(stdscr):
  53. global xyztxt
  54. global flicktxt
  55. global airwheeltxt
  56. global touchtxt
  57. global taptxt
  58. global doubletaptxt
  59. xyztxt = ''
  60. flicktxt = ''
  61. airwheeltxt = ''
  62. touchtxt = ''
  63. taptxt = ''
  64. doubletaptxt = ''
  65. while True:
  66. xyztxt = ''
  67. if len(flicktxt) > 0 and flickcount < 5:
  68. flickcount += 1
  69. else:
  70. flicktxt = ''
  71. flickcount = 0
  72. if len(airwheeltxt) > 0 and airwheelcount < 5:
  73. airwheelcount += 1
  74. else:
  75. airwheeltxt = ''
  76. airwheelcount = 0
  77. if len(touchtxt) > 0 and touchcount < 5:
  78. touchcount += 1
  79. else:
  80. touchtxt = ''
  81. touchcount = 0
  82. if len(taptxt) > 0 and tapcount < 5:
  83. tapcount += 1
  84. else:
  85. taptxt = ''
  86. tapcount = 0
  87. if len(doubletaptxt) > 0 and doubletapcount < 5:
  88. doubletapcount += 1
  89. else:
  90. doubletaptxt = ''
  91. doubletapcount = 0
  92. time.sleep(10)