NextPCB
Published © Apache-2.0

How to Build a Pico Macro Pad

hey, friends In this instructable, I am going to show you How to Build a Macro Pad using Raspberry pi pico

IntermediateFull instructions provided3 hours28,089
How to Build a Pico Macro Pad

Things used in this project

Hardware components

Raspberry Pi Pico
Raspberry Pi Pico
×1
Gateron switches
×1
Grove - Mech Keycap
Seeed Studio Grove - Mech Keycap
×1
Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

thonny

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

f2fx0n6kqxs4au2_bBzxqLG8Mj.png

Code

Code

Python
# Originally coded by Novaspirit Tech
# Copy this code into your code.py file.
import time
import usb_hid
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard import Keyboard
import board
import digitalio
# These are the corresponding GPIOs on the Pi Pico
# that you soldered
btn1_pin = board.GP1
btn2_pin = board.GP2
btn3_pin = board.GP3
btn4_pin = board.GP4
btn5_pin = board.GP5
btn6_pin = board.GP6
btn7_pin = board.GP21
btn8_pin = board.GP20
btn9_pin = board.GP19
btn1 = digitalio.DigitalInOut(btn1_pin)
btn1.direction = digitalio.Direction.INPUT
btn1.pull = digitalio.Pull.DOWN
btn2 = digitalio.DigitalInOut(btn2_pin)
btn2.direction = digitalio.Direction.INPUT
btn2.pull = digitalio.Pull.DOWN
btn3 = digitalio.DigitalInOut(btn3_pin)
btn3.direction = digitalio.Direction.INPUT
btn3.pull = digitalio.Pull.DOWN
btn4 = digitalio.DigitalInOut(btn4_pin)
btn4.direction = digitalio.Direction.INPUT
btn4.pull = digitalio.Pull.DOWN
btn5 = digitalio.DigitalInOut(btn5_pin)
btn5.direction = digitalio.Direction.INPUT
btn5.pull = digitalio.Pull.DOWN
btn6 = digitalio.DigitalInOut(btn6_pin)
btn6.direction = digitalio.Direction.INPUT
btn6.pull = digitalio.Pull.DOWN
btn7 = digitalio.DigitalInOut(btn7_pin)
btn7.direction = digitalio.Direction.INPUT
btn7.pull = digitalio.Pull.DOWN
btn8 = digitalio.DigitalInOut(btn8_pin)
btn8.direction = digitalio.Direction.INPUT
btn8.pull = digitalio.Pull.DOWN
btn9 = digitalio.DigitalInOut(btn9_pin)
btn9.direction = digitalio.Direction.INPUT
btn9.pull = digitalio.Pull.DOWN
keyboard = Keyboard(usb_hid.devices)
# below are the key values that you can change to
# fit your preferences. Change Keycode.ONE for example to
# (Keycode.CONTROL, Keycode.F4) for CTRL + F4
# on the first button.
# See the official CircuitPython docs
# for additional help
while True:
if btn1.value:
keyboard.send(Keycode.ONE)
time.sleep(0.1)
if btn2.value:
keyboard.send(Keycode.FOUR)
time.sleep(0.1)
if btn3.value:
keyboard.send(Keycode.SEVEN)
time.sleep(0.1)
if btn4.value:
keyboard.send(Keycode.TWO)
time.sleep(0.1)
if btn5.value:
keyboard.send(Keycode.FIVE)
time.sleep(0.1)
if btn6.value:
keyboard.send(Keycode.EIGHT)
time.sleep(0.1)
if btn7.value:
keyboard.send(Keycode.THREE)
time.sleep(0.1)
if btn8.value:
keyboard.send(Keycode.SIX)
time.sleep(0.1)
if btn9.value:
keyboard.send(Keycode.NINE)
time.sleep(0.1)
time.sleep(0.1)

Credits

NextPCB

NextPCB

21 projects • 45 followers
We share Electrical, Electronics, Power, Robotics, Software, Communication, IOT “Internet Of Things”, based projects

Comments