i'm looking for a simple way to transfer pot value from my µc to a webpage on a mobiledevice.
My pot and µc are plugged into my mobile trough usb
Yes lot of things.
i'm able to use send pot value by midi protocole, but this is not compliant with mobile browser (no web midi api) mytest
i've tried USBHid lib to send value as an "hid message" (find script in the doc ) but i'm unable to received usable value sent in the browser, i received charcode for digit value... don't understand why!
I've tried to send value (0-127) as charcode but some value are unavailable as charcode. and i'm unable to translate in digit value as keyEvent.key give only char not charCode. (unable to translate to digit)
I've tried sometime ago MouseHID but in my "souvenir" it was not as usefull as excepted when mouse move value push the pointer(cursor) out of the screen size (have to try again to be sure).
sure it's a major security breach and needs to be managed super carefully
this approach
is just by pretending to be a keyboard. that's an option if the cursor is in the right field and ready to receive text input, like someone was typing on a keyboard
yes! this is exactly what i want.
i search a simple solution easy to install on a phone or tablet.
it is for playing with a linear pot and pictures sequences on a mobile phone or desktop.
love web tech, easy to code, browser are on all mobile...
can code a wepapp and cache all images and it'll work offline.
when webpage has the focus (default behaviour on mobile browser) page received keystroke...
received "Digit1Digit0Digit0Enter" for 100 sent
then need to clean the output
window.addEventListener("keydown", (event) => {
if (event.key !== undefined) {
switch (event.code) {
case 'Enter':
// transform string to number
potValue = parseInt(table.join(""));
// write in body
document.body.innerHTML = potValue;
// or do what i want with this numeric value
// reinit array
table = [];
break;
default:
// remove "Digit" in the string and push in the array
table.push(event.code.replace(/Digit/gm,""));
}
}
});