import time, board, analogio, usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

sensors = [analogio.AnalogIn(p) for p in
           (board.GP26, board.GP27, board.GP28)]
keys = [Keycode.Z, Keycode.X, Keycode.C]
keyboard = Keyboard(usb_hid.devices)

# REPLACE these examples with YOUR six readings.
RELEASED = [30000, 30000, 30000]
PRESSED  = [45000, 45000, 45000]
held = [False, False, False]

while True:
    for i, sensor in enumerate(sensors):
        span = PRESSED[i] - RELEASED[i]
        if abs(span) < 1000:
            continue  # Reposition/calibrate this sensor.
        travel = (sensor.value - RELEASED[i]) / span
        if not held[i] and travel >= 0.55:
            keyboard.press(keys[i])
            held[i] = True
        elif held[i] and travel <= 0.35:
            keyboard.release(keys[i])
            held[i] = False
    time.sleep(0.005)
