I have a problem, one column on my keyboard 4x4 doesn't work. When I pressed one of button the column has 4.7V, but when I pressed third column the pin has 4V and arduino can't read it. What can be reason of it and how can I repair this? Maybe the keyboard is broken but one week ago this work right.
Hi, @lisekpolska
Welcome to the forum.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Can you please post your code, in code tags as instructed in the link above.
Some images of your project would also help.
Thanks.. Tom..
![]()
Welcome to the forum
I assume that you are talking about a keypad rather than a keyboard. Is the third column using pin 13 of a Uno or Nano board by any chance ?
If not then please post a schematic of your project and details of the Arduino board that you are using
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <string.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte ROW_NUM = 4;
const byte COL_NUM = 3;
char keys[ROW_NUM][COL_NUM] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte pin_rows[ROW_NUM] = {9, 8, 7, 6};
byte pin_column[COL_NUM] = {5, 4, 3};
Keypad keypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COL_NUM);
String pin = "";
String okPin = "7355608";
int counting = 40;
unsigned long nowTime = 0;
unsigned long rememberTime = 0;
//unsigned long roznicaCzasu = 0;
unsigned long rememberTime2 = 0;
bool armed = false;
float ledTime = 0;
String defuse = "";
String defuseOk = "2137";
int i = 0;
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Bomba CS:GO");
lcd.setCursor(0, 1);
lcd.print("Kod: *******");
Serial.begin(9600);
pinMode(10, OUTPUT);
}
void loop() {
nowTime = millis();
char key = keypad.getKey();
if (key && !armed) {
if(key != '#' && key != '*'){
//Serial.print(key);
pin += key;
lcd.setCursor(0, 1);
lcd.print("Kod: ");
switch(pin.length()){
case 1:
lcd.print("******");
break;
case 2:
lcd.print("*****");
break;
case 3:
lcd.print("****");
break;
case 4:
lcd.print("***");
break;
case 5:
lcd.print("**");
break;
case 6:
lcd.print("*");
break;
}
lcd.print(pin);
}
else if(key == '#' && pin == okPin){
armed = true;
lcd.clear();
}
else if(key == '*' && !armed){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Bomba CS:GO");
lcd.setCursor(0, 1);
lcd.print("Kod: *******");
pin = "";
}
}
if (key && pin == okPin && armed) {
if(key != '#' && key != '*'){
defuse += key;
lcd.setCursor(8, 1);
lcd.print(defuse);
}
else if(key == '#' && i >= 1){
if(defuse == defuseOk){
armed = false;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rozbrojona");
}
else{
armed = false;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Wybuchlo");
digitalWrite(10, HIGH);
}
}
else if(key == '#' && i <= 0){
i += 1;
}
}
if(pin == okPin && armed){
if(nowTime - rememberTime >= 1000UL){
lcd.setCursor(0,0);
lcd.print("Czas do wybuchu: ");
lcd.setCursor(0,1);
lcd.print(counting);
lcd.setCursor(3, 1);
lcd.print("Pin: ");
if(counting <= 0){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("wybuchlo");
}
if(counting < 10){
lcd.setCursor(1,1);
lcd.print(" ");
lcd.setCursor(3, 1);
}
counting -= 1;
rememberTime = nowTime;
}
ledTime = counting;
ledTime = map(ledTime, 0, 40,100, 1000);
if(nowTime - rememberTime2 >= (long)ledTime){
digitalWrite(10,HIGH);
delay(20);
digitalWrite(10, LOW);
rememberTime2 = nowTime;
}
}
}
This code was writing in polish.
It's not final code but before it work. I mean it turned on and I can input pin to armed and the timer go down to 0.
What do you see if you print the value of key after a call to getKey() ?
Do the ABCD keys work if you use 4th column ?
Before it worked right but now 3 column has 4V when I push key but other column has 4.7V. Arduino doesn't "see" that the key is push.
I only use 3 column so 4 is disconnected, you can see it in code.
I know that you are not using the 4th column but what happens if you move the 3rd column connection to the 4th column pin and add 4 more values to the array? Do you get the values for key that you should ?
I think the proposal was to try column four, in addition to as well as instead of column three.
Two experiments. Five minutes. Report.
a7
When I connect fourth column to third column pin it works again. I thin the keypad is broken.
Hypothesis. Experiment. Data. Conclusion.
I thin you are correct. Absolute proof would be to try your new keyboard. Some of us would obsess and try to find out how and why the one you have is broken. Others know life is too short.
a7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.


