A small, affordable computer with free resources to help people learn, make things, and have fun
https://forums.raspberrypi.com/
Code: Select all
from machine import Pin, ADC
import time
fsr_pin = ADC(26)
NOISE = 1000
MAX_RAW_VALUE = 65535
print("FSR started")
def pressure_percentage(raw_adc):
if raw_adc<NOISE:
return 0
percentage = (raw_adc - NOISE)/(MAX_RAW_VALUE - NOISE)*100
return round(percentage, 1)
while True:
raw_value = fsr_pin.read_u16()
print (pressure_percentage(raw_value))
time.sleep(0.2)My understanding is the MicroPython USB_HID module is only available for the PyBoard port and not the for the Pico / RP2 port.OllieLearnsCode wrote: ↑Fri Oct 24, 2025 7:38 pmI believe I can do this with the usb_hid module but I get an error that it isn't found.