We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

3 posts • Page 1 of 1
OllieLearnsCode
Posts: 1
Joined: Fri Oct 24, 2025 7:25 pm

Pi Pico Pressure sensor as pen tablet input

Fri Oct 24, 2025 7:38 pm

Hello,

I have a pi pico and a Circular forse sensitive resistor

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)
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

hippy
Posts: 19831
Joined: Fri Sep 09, 2011 10:34 pm

Re: Pi Pico Pressure sensor as pen tablet input

Sat Oct 25, 2025 10:01 am

OllieLearnsCode wrote:
Fri Oct 24, 2025 7:38 pm
I believe I can do this with the usb_hid module but I get an error that it isn't found.
My understanding is the MicroPython USB_HID module is only available for the PyBoard port and not the for the Pico / RP2 port.

CircuitPython, based on MicroPython, does appear to have a usb_hid module which works with Pico / RP2 devices so that's probably the easiest path to take.


3 posts • Page 1 of 1

Return to "MicroPython"

AltStyle によって変換されたページ (->オリジナル) /