With this project, you will be able to make your Raspberry Pi Pico function as a macro pad and send keystrokes to your computer. In this example, I'll use CTRL+C and CTRL+V, but you can program it to send whatever you want. I'll also only use two buttons, but you should be able to use more if you have them.
First, click on 'New Project'. It should then appear to the right of the button you just clicked. Click on it and it should open a blank programming window.
Start by grabbing the start block from the 'Chip' section and placing it in the workspace. Then, grab the repeat forever loop from the 'Loops' section and connect it to the start block.
Then, grab two if statements from the 'Logic' section and put them in the loop.
After that, you're going to want to put an is pin 0 LOW when pulled UP in the hexagons in each of the if statements. Set the first one to pin 7 and the second one to pin 8. This means that whatever is inside the corresponding if block will run if the button connected to the specified pin is pushed.
Now, go to the 'Actions' tab and take two keyboard press blocks and one keyboard release keys block. Put them all in the first if.
After that, you should set the keys that the two keyboard press blocks activate.
- Set the first block to Control (Left)
- Set the second block to c C
Do the last two steps for the second if block except instead of c C use v V.
Go to the 'Chip' section and take two wait 1 seconds blocks and put them under each keyboard release keys block. Set each of them to 0.5 seconds instead of 1 second. This prevents the key from accidentally being pressed twice.
Now, change the "wait 0.5 seconds" at the bottom of the repeat forever loop to 0. This will make the loop run much faster.
It's time to wire everything up.
- Orange wire - Connect GP7 (10th pin) to the left pin on the first button
- Blue wire - Connect GP8 (11th pin) to the left pin on the second button
- Black wire - Connect GND (8th pin) to the right pin on the second button
- Black wire - Connect the right pin on the first button to the right pin on the second button.
Here's what mine looked like after I hooked everything up.
Now, press the 'Start' button in the upper left-hand corner of the screen. It should put the code on your Pico and run it. If the 'Start' button isn't green, you may have to press the 'Connect' button again to reconnect your Pico.
Now that the code is running, you can highlight some text and press the left button on the breadboard to copy it. To paste it, just press the right button.
Text editor powered by tinymce.