## pour tester : sudo jstest-gtk
hid = pyb.USB_HID()
xin = pyb.Pin("A7")
yin = pyb.Pin("A6")
x = pyb.ADC(xin)
y = pyb.ADC(yin)
buf = bytearray(4)
while 1:
val_x = int(x.read())
sup_x = val_x >> 8
inf_x = val_x & 255
val_y = int(y.read())
sup_y = val_y >> 8
inf_y = val_y & 255
buf[1] = sup_x
buf[0] = inf_x
buf[3] = sup_y
buf[2] = inf_y
print(val_x, val_y, buf)
hid.send(buf)
pyb.delay(20)
print(".", end="") #prints a . each time a HID packet is sent