This example shows how to use the Mindsensors PSP device to read the left and right buttons.
"PSP L/R demo" "lib/modules/standard.whl" "lib/modules/device.whl" "lib/modules/sensor.whl" "lib/modules/screen.whl" "lib/modules/psp.whl" "EV3, PSP" proc drawButtonOutline(number x, number y) drawRect(x, y, 22, 12) end proc drawButton(number x, number y, number fillColor) setFillColor(toBit(fillColor)) drawRect(x, y, 20, 10) end proc main() ; Select the EV3 device in the simulator... selectDevice(DEVICE_EV3) pspStart(INPUT_1) number lastL1 = 0 number lastL2 = 0 number lastR1 = 0 number lastR2 = 0 drawButtonOutline(66, 43) drawButtonOutline(66, 63) drawButtonOutline(91, 43) drawButtonOutline(91, 63) updateScreen() setFill(TRUE) repeat if pspData.buttonL1 != lastL1 lastL1 = pspData.buttonL1 drawButton(67, 44, lastL1) end if pspData.buttonL2 != lastL2 lastL2 = pspData.buttonL2 drawButton(67, 64, lastL2) end if pspData.buttonR1 != lastR1 lastR1 = pspData.buttonR1 drawButton(92, 44, lastR1) end if pspData.buttonR2 != lastR2 lastR2 = pspData.buttonR2 drawButton(92, 64, lastR2) end updateScreen() end end