A simple multiplication calculator, on Raspberry Pi Pico W with Maker Pi Pico
With the Pico W attached on top of the Maker Board (see image for reference of maker Board), the Pico W will:
- Count the number of presses on
GP20andGP21respectively. - The counted number on
GP20, stored as variableA, will be displayed in 4-bit binary form. Ranging fromGP2toGP5, withGP2being the MSB (most significant bit). - The counted number on
GP21, stored as variableB, will be displayed in 4-bit binary form. Ranging fromGP6toGP9, withGP6being the MSB. - Pressing
GP22will perform a multiplication onAandB. The value will be displayed in 6-bit binary form, ranging fromGP10toGP15, withGP15being the MSB.- In the event that the result is unable to fit into 6 bits (overflow), all LEDs from
GP10toGP15will light up, andGP0will become a 'breathing' light. (Basically, slowly dim up/down in brightness)
- In the event that the result is unable to fit into 6 bits (overflow), all LEDs from
- After
GP22is pressed, system will wait for 5 seconds, then reset all led/button/variable value states.- During 5 second wait time, buttons are unresponsive.
NOTE_1:
GP0uses PWM to drive the signal, whileGP2toGP15are signalled using standardGPIO.
NOTE_2:GP20andGP21isn't expected to handle more than 16 presses. (aka, more tan 4-bits of presses)
NOTE: Install Pico C SDK if you haven't done so yet, with enviorment variable setup.
- In the
srcdirectory, make a new folder calledbuild. - Open a terminal, access the
buildfolder. - Run
cmake .. - Run
build
A main.uf2 file should appear in the build directory.
With the Raspberry Pi Pico W:
- Press and hold the button on the Pico W, then connect via USB to your PC.
- After a 3 seconds or so, let go of the button.
- you should see a new device media (Should be somthing like 'Pi2') appear on your respective file explorer program.
- Drop and drop the
main.uf2into the new device media.
Enjoy ㊗️
