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.

93 lines
2.3 KiB

4 years ago
4 years ago
4 years ago
  1. from logitech.g19 import G19
  2. import time
  3. import array
  4. print("Start")
  5. print("-----------------------")
  6. if __name__ == '__main__':
  7. lg19 = G19(True)
  8. lg19.start_event_handling()
  9. try:
  10. data = []
  11. r = 255
  12. g = 0
  13. b = 255
  14. # b1 = lg19.rgb_to_uint16(r,g,b) >> 8
  15. # b2 = lg19.rgb_to_uint16(r,g,b) & 0xff
  16. # print(lg19.rgb_to_uint16(r,g,b))
  17. # print("-----------------------")
  18. # print(b1)
  19. # print(b2)
  20. # for x in range(320):
  21. # for y in range(240):
  22. # data.append(0)
  23. # data.append(b2)
  24. #print(str(data))
  25. #print(array.array('B', str(data)))
  26. #frame = array.array('B', str(data))
  27. #lg19.fill_display_with_color(0, 0, 255)
  28. #lg19.fill_display_with_color(255, 0, 0)
  29. #lg19.set_display_colorful
  30. #lg19.load_image("img/6.jpg")
  31. c = 1
  32. while True:
  33. lg19.load_image("img/" + str(c) + ".jpg")
  34. if c == 5:
  35. c = 1
  36. else:
  37. c = c + 1
  38. time.sleep(1/60)
  39. # lg19.load_image("img/3.jpeg")
  40. # data = []
  41. # for x in range(320):
  42. # for y in range(240):
  43. # data.append(0)
  44. # data.append(248)
  45. # print(c)
  46. # lg19.send_frame(data)
  47. print("-----------------------")
  48. finally:
  49. print("Stop!!!!")
  50. lg19.stop_event_handling()
  51. # # if you get an error: lg19 = G19(True)
  52. # lg19 = G19()
  53. # lg19.reset()
  54. # print(lg19)
  55. # # # setting backlight to red
  56. # # fill your display with green
  57. # lg19.fill_display_with_color(0, 255, 0)
  58. # # test your screen
  59. # lg19.set_display_colorful()
  60. # # set backlight to blue after reset
  61. # # this will be your backlight color after a bus reset (or switching the keyboard
  62. # # off and no)
  63. # lg19.save_default_bg_color(0, 0, 255)
  64. # # send an image to display
  65. # # data = [...] # format described in g19.py
  66. # # lg19.send_frame(data)
  67. # # load an arbitrary image from disk to display (will be resized non-uniform)
  68. # lg19.load_image("img/pyboy.jpg")
  69. # # reset the keyboard via USB
  70. # # now you have to rebuild the connection:
  71. # lg19 = G19()