| Posted: 04:48am 23 Jul 2026 |
Copy link to clipboard |
 Print this post |
|
Well guy's I am trying to get the mouse working in my first start on the pico 3 using MMBasic while I wait for the psram and wifi chips to arrive.
With the new GUI for HDMI just getting a mouse going is my first step and this is my code so far
OPTION EXPLICIT OPTION DEFAULT NONE option console serial gui cursor on colour rgb(grey), rgb(white)
cls
const topcaption= 1, btmcaption = 2, Memcar = 3, Memlog = 4, Memfin = 5 const topF = 6, list1 = 7 'fill = rgb(white) gui frame #1, "", 4, 4, 636, 30, rgb(grey) gui frame #2, "", 4, 450, 636, 30, rgb(grey)
'gui frame #topF, "", 4, 4, 636, 30, rgb(red) dim k$ dim club$(4) length 16 club$(0) = "Member Number" : club$(1) = "Member Name" :club$(2) = "Car" club$(3) = "Logbook Number" : club$(4) = "Status"
gui listbox #list1, club$(), 5, 5, 200, 30, rgb(white), rgb(red) do k$ = Inkey$ If k$ <> "" Then ' Default step 4 px; if the key arrived shifted, MMBasic delivers ' a different code. Keep it simple: hold Shift-equivalent on PS/2 ' by using upper-case letters of D/U as "fast". stepx = 4 Select Case Asc(k$) Case &H82 ' LEFT mx = mx - Stepx Case &H83 ' RIGHT mx = mx + Stepx Case &H80 ' UP my = my - Stepx Case &H81 ' DOWN my = my + Stepx Case 32 ' SPACE -> momentary click GUI Click mx, my Case 100, 68 ' 'd' or 'D' -> press-and-hold If held = 0 Then GUI Cursor mx, my GUI Click Down held = 1 EndIf Case 117, 85 ' 'u' or 'U' -> release If held = 1 Then GUI Click Up held = 0 EndIf Case 27, 113, 81 ' ESC / 'q' / 'Q' -> quit Exit Do End Select ' Clamp to screen. If mx < 0 Then mx = 0 If my < 0 Then my = 0 If mx > cw - 1 Then mx = cw - 1 If my > ch - 1 Then my = ch - 1 GUI Cursor mx, my endif
pause 1000 loop
sub touchdown local integer tx, ty tx = touch(x) : ty = touch(y) if not (tx = -1 or ty = -1) then gui cursor tx, ty ' mx = tx : my = ty endif
Now looking on search I did see the mouse option and I put the mouse dongle in the usb hub which works in edit but sadly not in my code.
> option mouse sensitivity 1.0000 > Mouse Type: Gaming 16-bit X/Y bits: 16/16 Buttons: 5 Report length: 7 bytes Has wheel: Yes (byte 5) Has pan: No USB Mouse Connected on channel 2 > US USB Keyboard Connected on channel 1
> option list PicoMiteHDMI MMBasic USB RP2350B Edition V6.03.00 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION SYSTEM I2C GP20,GP21 OPTION FLASH SIZE 16777216 OPTION COLOURCODE ON OPTION MOUSE SENSITIVITY 1.0000 OPTION KEYBOARD US OPTION PICO OFF OPTION RESOLUTION 640x480 @ 315000KHz OPTION HDMI PINS 1, 3, 5, 7 OPTION GUI CONTROLS 75 OPTION SDCARD GP33, GP30, GP31, GP28 OPTION AUDIO I2S GP10,GP22', ON PWM CHANNEL 11 OPTION RTC AUTO ENABLE OPTION COUNT GP34,GP35,GP36,GP37 OPTION MODBUFF ENABLE 512 OPTION PLATFORM PICO COMPUTER 3 OPTION HEARTBEAT PIN GP25 |