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.
 
 

94 lines
2.3 KiB

from logitech.g19 import G19
import time
import array
print("Start")
print("-----------------------")
if __name__ == '__main__':
lg19 = G19(True)
lg19.start_event_handling()
try:
data = []
r = 255
g = 0
b = 255
# b1 = lg19.rgb_to_uint16(r,g,b) >> 8
# b2 = lg19.rgb_to_uint16(r,g,b) & 0xff
# print(lg19.rgb_to_uint16(r,g,b))
# print("-----------------------")
# print(b1)
# print(b2)
# for x in range(320):
# for y in range(240):
# data.append(0)
# data.append(b2)
#print(str(data))
#print(array.array('B', str(data)))
#frame = array.array('B', str(data))
#lg19.fill_display_with_color(0, 0, 255)
#lg19.fill_display_with_color(255, 0, 0)
#lg19.set_display_colorful
#lg19.load_image("img/6.jpg")
c = 1
while True:
lg19.load_image("img/" + str(c) + ".jpg")
if c == 5:
c = 1
else:
c = c + 1
time.sleep(1/60)
# lg19.load_image("img/3.jpeg")
# data = []
# for x in range(320):
# for y in range(240):
# data.append(0)
# data.append(248)
# print(c)
# lg19.send_frame(data)
print("-----------------------")
finally:
print("Stop!!!!")
lg19.stop_event_handling()
# # if you get an error: lg19 = G19(True)
# lg19 = G19()
# lg19.reset()
# print(lg19)
# # # setting backlight to red
# # fill your display with green
# lg19.fill_display_with_color(0, 255, 0)
# # test your screen
# lg19.set_display_colorful()
# # set backlight to blue after reset
# # this will be your backlight color after a bus reset (or switching the keyboard
# # off and no)
# lg19.save_default_bg_color(0, 0, 255)
# # send an image to display
# # data = [...] # format described in g19.py
# # lg19.send_frame(data)
# # load an arbitrary image from disk to display (will be resized non-uniform)
# lg19.load_image("img/pyboy.jpg")
# # reset the keyboard via USB
# # now you have to rebuild the connection:
# lg19 = G19()