I'm trying to code my raspberry pi and am brand new to coding like this but was curious is there was a command to hold a key rather than simply a press? Heres the code I have.
import time
import usb_hid
import random
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
keyboard = Keyboard(usb_hid.devices)
TIMER_1_DELAY = 1
TIMER_4_DELAY = 250
now = time.monotonic()
timer_1_next_run = now + TIMER_1_DELAY
timer_4_next_run = now + 90
def jumphit(x):
keyboard.press(Keycode.RIGHT_ARROW)
time.sleep(0.1)
do_key(Keycode.ALT, 0.1)
do_key(Keycode.ALT, 0.1)
time.sleep(0.1)
do_key(Keycode.A, 0.1)
keyboard.release(Keycode.RIGHT_ARROW)
def smalljump(x):
keyboard.press(Keycode.UP_ARROW)
time.sleep(0.1)
keyboard.press(Keycode.ALT)
time.sleep(1)
keyboard.release(Keycode.ALT)
time.sleep(0.1)
keyboard.release(Keycode.UP_ARROW)
On the def smalljump(x): I want to hold the ALT key rather than a press and release.
Any help?
