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.

92 lines
2.3 KiB

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. c = 1
  31. while True:
  32. lg19.load_image("img/" + str(c) + ".jpg")
  33. if c == 5:
  34. c = 1
  35. else:
  36. c = c + 1
  37. time.sleep(1)
  38. # lg19.load_image("img/3.jpeg")
  39. # data = []
  40. # for x in range(320):
  41. # for y in range(240):
  42. # data.append(0)
  43. # data.append(248)
  44. # print(c)
  45. # lg19.send_frame(data)
  46. print("-----------------------")
  47. finally:
  48. print("Stop!!!!")
  49. lg19.stop_event_handling()
  50. # # if you get an error: lg19 = G19(True)
  51. # lg19 = G19()
  52. # lg19.reset()
  53. # print(lg19)
  54. # # # setting backlight to red
  55. # # fill your display with green
  56. # lg19.fill_display_with_color(0, 255, 0)
  57. # # test your screen
  58. # lg19.set_display_colorful()
  59. # # set backlight to blue after reset
  60. # # this will be your backlight color after a bus reset (or switching the keyboard
  61. # # off and no)
  62. # lg19.save_default_bg_color(0, 0, 255)
  63. # # send an image to display
  64. # # data = [...] # format described in g19.py
  65. # # lg19.send_frame(data)
  66. # # load an arbitrary image from disk to display (will be resized non-uniform)
  67. # lg19.load_image("img/pyboy.jpg")
  68. # # reset the keyboard via USB
  69. # # now you have to rebuild the connection:
  70. # lg19 = G19()