[Tutorial] How to compile and upload code to the keypad

tinkering
arduino
keypad

#1

I decided to change the buttons layout of my cpi, from XY AB to AB XY because I felt more confortable that way and the thumb is in a better resting position, also I am really used to a Gameboy Color position
image

And found out that there is a bit of lack of information at plain sight (There is information, but you need to check the schematics) so I decided to make this guide to save you time for such a straightforward task that took me longer than I expected.

First things first.

If we don´t have it already, we need arduino ide. There is a portable version but I recommend you to install it.

As many arduino clones, they don´t come with the same usb chip as the genuine arduino uno, they come with its chinese counterpart CH340 we need to install the driver in order to use USB to serial and get to see the COM port on Arduino IDE.

We can download it from the manufacturer website: http://www.wch.cn/download/CH341SER_EXE.html

Direct links:

Almost there

Now we need to download the UsbKeyboard library from github and the code of the keypad from here

After we got the UsbKeyboard folder, we need to zip it and include it to our Arduino IDE from Sketch -> Include library -> Add .zip library

image

Note: You can also install the library by pasting the uncompressed folder in Documents/Arduino/libraries but for the sake of simplicity I explained the other way around.
image

Now we are ready for the fun part

Connect the keypad via usb to your computer and check on Arduino IDE if it recognises the COM port.

image

Now that we are here lets configure our board.

Board: Arduino Nano
Processor: ATmega168
Port: Chose the arduino comp port, it should be set automatically when recognised.

Programmer: leave it default, should be AVRISP mkII

Now we are set

You can open now the code on the IDE and change what we want. We can hit Upload and watch the flashy lights on our board while we wait.

image

A succesful upload should look like this:

Happy hacking :man_mechanic:


How to change LightKey binding?
Keypad not working