EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: blackjames on August 02, 2012, 09:14:36 am

Title: arduino keypad help needed!
Post by: 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);
  }
}
Title: Re: arduino keypad help needed!
Post by: dda on August 02, 2012, 09:32:12 am
It compiles fine for me (Arduino 1.0.1). Is the Keypad folder in the libraries folder?
Title: Re: arduino keypad help needed!
Post by: blackjames on August 02, 2012, 09:37:09 am
i think it dosent work because i have arduino 1.0, and it is in the libraries folder.
Title: Re: arduino keypad help needed!
Post by: Chet T16 on August 02, 2012, 09:59:29 am
What error?
Title: Re: arduino keypad help needed!
Post by: bsiswoyo on August 09, 2012, 12:57:32 am
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/ (http://bsiswoyo.lecture.ub.ac.id/2012/02/keypad-using-adc-a-microcontroller-application/)

Best regard
Bambang Siswoyo

 
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);
  }
}