This guide was created on 2021/12/02, using a MacBook Pro running macOS Monterey v12.0.1.
This is mostly for my own information, but please feel free to use it yourself and make comments!
(Or run brew update
if already installed!)
import board # Lists the pin names for the board we're using | |
from time import sleep | |
# Set up the USB Human Interface Device (HID) libraries | |
import usb_hid | |
from adafruit_hid.consumer_control import ConsumerControl | |
from adafruit_hid.consumer_control_code import ConsumerControlCode | |
consumer_control = ConsumerControl(usb_hid.devices) | |
# Set up the analog input pin to read the pedal state |
import signal | |
def sighup_handler(signal_number, frame): | |
print "GOT A SIGHUP", signal_number, frame | |
if hasattr(signal, 'SIGHUP'): | |
signal.signal(signal.SIGHUP, sighup_handler) |