Ok. Here's a first draft. Again, we don't know that the pins are right, or that we fully understand the operation of the circuit, but frankly, there's not much else it could be.
I have simulated this with Wokwi, and it works. It might even work for real, but when you get your Arduino spend some time with the examples before you try the keypad.
I have simulated this with Wokwi, and it works. It might even work for real, but when you get your Arduino spend some time with the examples before you try the keypad.
Code:
// Code for shift-register based keypad// Arduino Pro Micro connected to keypad PCB// via JP1 (14-pin IDC header). Keypad is// constructed from nine '165 shift registers// in series, therefore 72 bits to shift out.// Connect Arduino VCC to JP1 pin 14 (VCC)// Connect Arduino GND to JP1 pin 1 (GND)// Connect Arduino 4 to JP1 pin 4 (DATA)// Connect Arduino 2 to JP1 pin 6 (CLK)// Connect Arduino 3 to JP1 pin 8 (~PL)// GPIOs connected to keypad PCB int dataPIN = 4;int latchPIN = 3; // Active lowint clockPIN = 2; // Shift data on rising edgevoid setup() { // put your setup code here, to run once: // Setup serial port Serial.begin(115200); // Set up pin objects // Pull-up not needed on data pin because it is driven externally pinMode(dataPIN, INPUT); // Include initial pin states here pinMode(latchPIN, OUTPUT); digitalWrite(latchPIN, HIGH); pinMode(clockPIN, OUTPUT); digitalWrite(clockPIN, LOW);}void loop() { // put your main code here, to run repeatedly: // Shift out registers from the PCB and show the value delay(10); digitalWrite(latchPIN, LOW); // Latch pins into register delay(1); digitalWrite(latchPIN, HIGH); delay(1); // For testing look at the first 8 bits for (int i=0; i<8; i++) { // Bits are shifted out MSb (bit 7) first Serial.print("D"); Serial.print(7-i); Serial.print(" "); Serial.println(digitalRead(dataPIN)); digitalWrite(clockPIN, HIGH); // Clock out next bit delay(1); digitalWrite(clockPIN, LOW); delay(1); } Serial.println(); delay(1000);}
Statistics: Posted by ame — Sun May 26, 2024 7:20 am