The sketch is small because the keybrd library takes care of the low-level details. | The sketch is small because the keybrd library takes care of the low-level details. | ||||
It runs the breadboard keyboard in this picture. | It runs the breadboard keyboard in this picture. | ||||
<img src="tutorials/keybrd_1_breadboard/breadboard_keyboard_2x2.JPG" title="breadboard keyboard" alt="breadboard keyboard" height="290" width="328"> | |||||
<img src="tutorials/keybrd_1_breadboard/basic_breadboard_keyboard_front.JPG" title="basic breadboard keyboard" alt="basic breadboard keyboard" height="290" width="328"> | |||||
Example complex keybrd sketch | Example complex keybrd sketch | ||||
----------------------------- | ----------------------------- |
* [SPI I/O expander example sketch](keybrd_4c_split_with_IOE/keybrd_4c_split_with_IOE.ino) | * [SPI I/O expander example sketch](keybrd_4c_split_with_IOE/keybrd_4c_split_with_IOE.ino) | ||||
* [I2C I/O expander example sketch](../examples/keybrd_PCA9655E/keybrd_PCA9655E.ino) | * [I2C I/O expander example sketch](../examples/keybrd_PCA9655E/keybrd_PCA9655E.ino) | ||||
5. Study other keybrd port classes. | 5. Study other keybrd port classes. | ||||
* SPI I/O expander port classes: PortMCP23S17 PortWrite_MCP23S17 PortRead_MCP23S17 | |||||
* I2C I/O expander port classes: PortWrite_PCA9655E PortRead_PCA9655E | |||||
* SPI I/O expander port classes: Port_MCP23S17 | |||||
* I2C I/O expander port classes: Port_PCA9655E | |||||
6. Write the port classes for your I/O expander. | 6. Write the port classes for your I/O expander. | ||||
Debugging I/O expander code is hard because SPI or I2C protocol adds a level of indirection. | Debugging I/O expander code is hard because SPI or I2C protocol adds a level of indirection. | ||||
![basic breadboard keyboard overhead](keybrd_1_breadboard/basic_breadboard_keyboard_overhead.JPG "basic breadboard keyboard overhead") | ![basic breadboard keyboard overhead](keybrd_1_breadboard/basic_breadboard_keyboard_overhead.JPG "basic breadboard keyboard overhead") | ||||
3. Insert jumper wires to connect Arduino pins to the matrix rows and columns. | 3. Insert jumper wires to connect Arduino pins to the matrix rows and columns. | ||||
* [Teensy LC pinout diagram](https://www.pjrc.com/teensy/card6a_rev2.png). | |||||
* refer to the [Teensy LC pinout diagram](https://www.pjrc.com/teensy/card6a_rev2.png). | |||||
* row_0 is the top row, and col_0 is the left column | * row_0 is the top row, and col_0 is the left column | ||||
| Pin number | Connects to | | | Pin number | Connects to | |
This table lists what gets connected to the 74HC165 pins: | This table lists what gets connected to the 74HC165 pins: | ||||
``` | |||||
74HC165 left (lower half of breadboard) | |||||
NAME PIN# DESCRIPTION TO TEENSY LC PIN# CHAIN | |||||
SH/LD 1 shift or load input CS0 10 green wire | |||||
CLK 2 clock input SCK0 13 yellow wire | |||||
D4 3 parallel input | |||||
D5 4 parallel input | |||||
D6 5 parallel input | |||||
D7 6 parallel input | |||||
/QH 7 ~serial output | |||||
GND 8 ground gnd blue bus | |||||
74HC165 right (upper half of breadboard) | |||||
NAME PIN# DESCRIPTION TO TEENSY LC PIN# CHAIN | |||||
VCC 16 power pin 3.3V red wire | |||||
CLK INH 15 clock inhibit blue bus | |||||
D3 14 parallel input | |||||
D2 13 parallel input | |||||
D1 12 parallel input | |||||
D0 11 parallel input | |||||
SER 10 serial input blue wire to next QH | |||||
QH 9 serial output MISO0 12 blue wire to previous SER | |||||
``` | |||||
**74HC165 left (lower half of breadboard)** | |||||
|NAME |PIN#|DESCRIPTION |TO TEENSY LC PIN#|CHAIN | | |||||
|--------|:--:|--------------------|-----------------|-----------| | |||||
|SH/LD |1 |shift or load input |CS0 10 |green wire | | |||||
|CLK |2 |clock input |SCK0 13 |yellow wire| | |||||
| D4 |3 |parallel input | | | | |||||
| D5 |4 |parallel input | | | | |||||
| D6 |5 |parallel input | | | | |||||
| D7 |6 |parallel input | | | | |||||
|/QH |7 |~serial output | | | | |||||
|GND |8 |ground |gnd |blue bus | | |||||
**74HC165 right (upper half of breadboard)** | |||||
|NAME |PIN#|DESCRIPTION |TO TEENSY LC PIN#|CHAIN | | |||||
|--------|:--:|--------------------|-----------------|-------------------------| | |||||
|VCC |16 |power pin |3.3V |red wire | | |||||
|CLK INH |15 |clock inhibit | |blue bus | | |||||
| D3 |14 |parallel input | | | | |||||
| D2 |13 |parallel input | | | | |||||
| D1 |12 |parallel input | | | | |||||
| D0 |11 |parallel input | | | | |||||
|SER |10 |serial input | |blue wire to next QH | | |||||
| QH | 9 |serial output |MISO0 12 |blue wire to previous SER| | |||||
![breadboard keyboard with shift_registers](keybrd_4b_split_keyboard_with_shift_registers/overhead.JPG ) | ![breadboard keyboard with shift_registers](keybrd_4b_split_keyboard_with_shift_registers/overhead.JPG ) | ||||