Pages: 1 [2]   Go Down
Author Topic: 8/8 button matrix  (Read 1067 times)
0 Members and 1 Guest are viewing this topic.
Queens, New York
Online Online
Faraday Member
**
Karma: 98
Posts: 3568
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Refer to reply #9, your answer is at the bottom.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Global Moderator
Online Online
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The error I receive now is to declare keypad into

Copy the errors, paste them here.

"is to declare keypad into" doesn't make sense.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The error I receive now is to declare keypad into

Copy the errors, paste them here.

"is to declare keypad into" doesn't make sense.

The errors I get:
schetch_feb07a.ino: In function 'void loop()':
                       42: error: 'keypad was not declared in this scope
                       44: error: 'No_Key' was not declared in this scope

Just a few errors compared to the errors I got before.
Many thanks
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4225
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have declared and instance of Keypad and called it customKeypad
Code:
  Keypad customKeypad = Keypad( makeKeymap (keys), rowPins, colPins,
  Rows, Cols );
Later on you refer to it as keypad
Code:
   char key = keypad.getKey();
Change the second one to
Code:
   char key = customKeypad.getKey();
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49034
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
44: error: 'No_Key' was not declared in this scope
And it wasn't in the example I told you to look at, either. I've already told you what to do about this. Start listening.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

C is case-sensitive, if that helps.

DOG, Dog, dog. All different.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,
I want to thank you all for helping me.
This is my modified code and now it's working.
Wish you all the best.
Regards


Code:
// 8/8 keypad to print characters
// on computer display

#include <Keypad.h>

int R0=9;
int R1=8;
int R2=7;
int R3=6;
int R4=5;
int R5=4;
int R6=3;
int R7=2;

const byte Rows = 8; // 8 rows
const byte Cols = 8; // 8 columns
char keys [Rows] [Cols] ={
 
  {'a','b','c','d','e','f','g','h'},
  {'i','j','k','l','m','n','o','p'},
  {'q','r','s','t','u','v','w','x'},
  {'y','z','A','B','C','D','E','F'},
  {'G','H','I','J','K','L','M','N'},
  {'O','P','Q','R','S','T','U','V'},
  {'W','X','Y','Z','1','2','3','4'},
  {'5','6','7','8','9','0','.',','},
};

  byte rowPins [Rows] = {R0, R1, R2, R3, R4, R5, R6, R7};
  // connect to row pinouts of the keypad
  byte colPins [Cols] = {A0, A1, A2, A3, A4, A5, A6, A7};
  // connect to column pinouts of keypad
 
  Keypad customKeypad = Keypad( makeKeymap (keys), rowPins, colPins,
  Rows, Cols );
 
  void setup()
  {
    Serial.begin (9600);
  }
  void loop() {
    char customKey = customKeypad.getKey();
   
    if (customKey){
      Serial.println(customKey);
    }
  }
 
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 114
Posts: 4225
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well done.

What other plans do you have for the keypad ?
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well done.

What other plans do you have for the keypad ?
I want to connect a GLCD to my project and to insert a custom
character for each button. As I can see, I have a lot of programming
for doing this. It looks very scary because I don't have too
much experience.
Perhaps some short indications would be helpful.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 533
Posts: 26937
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

switch (customKey){
case 'a':
:
:
break;
case 'b':
:
:
break;
// etc.
}
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you very much.
I will try to do it when I can find some time.
Regards
Logged

Pages: 1 [2]   Go Up
Jump to: