Electronics > Microcontrollers
arduino keypad help needed!
(1/1)
blackjames:
hi, recently i downloaded the arduino keypad library, and opened one of the example sketches. for some reason, the IDE doesnt approve the program when i press "verify". does anyone know why this happens.
here is the program:
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
dda:
It compiles fine for me (Arduino 1.0.1). Is the Keypad folder in the libraries folder?
blackjames:
i think it dosent work because i have arduino 1.0, and it is in the libraries folder.
Chet T16:
What error?
bsiswoyo:
To create keypad for easy, use adc of ATmega on arduino.
Visit: http://bsiswoyo.lecture.ub.ac.id/2012/02/keypad-using-adc-a-microcontroller-application/
Best regard
Bambang Siswoyo
--- Quote from: blackjames on August 02, 2012, 09:14:36 am ---hi, recently i downloaded the arduino keypad library, and opened one of the example sketches. for some reason, the IDE doesnt approve the program when i press "verify". does anyone know why this happens.
here is the program:
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
--- End quote ---
Navigation
[0] Message Index
Go to full version