Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7513

MicroPython • Pi Pico Pressure sensor as pen tablet input

$
0
0
Hello,

I have a pi pico and a Circular forse sensitive resistor

Code:

from machine import Pin, ADCimport timefsr_pin = ADC(26)NOISE = 1000MAX_RAW_VALUE = 65535print("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)
This code reads the pressure and it works well. However, I now want windows to recognise this input as a pen tablet pressure. I believe I can do this with the usb_hid module but I get an error that it isn't found. How do i get the usb_hid input working no my pi Pico? thanks

Statistics: Posted by OllieLearnsCode — Fri Oct 24, 2025 7:38 pm — Replies 0 — Views 26



Viewing all articles
Browse latest Browse all 7513

Trending Articles