Go Down

Topic: 8/8 button matrix (Read 1 time) previous topic - next topic

HazardsMind

Refer to reply #9, your answer is at the bottom.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

littlewolf



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

UKHeliBob

You have declared and instance of Keypad and called it customKeypad
Code: [Select]
  Keypad customKeypad = Keypad( makeKeymap (keys), rowPins, colPins,
  Rows, Cols );

Later on you refer to it as keypad
Code: [Select]
   char key = keypad.getKey();
Change the second one to
Code: [Select]
   char key = customKeypad.getKey();
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PaulS

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.

Nick Gammon

C is case-sensitive, if that helps.

DOG, Dog, dog. All different.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

littlewolf

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: [Select]
// 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);
    }
  }
 

UKHeliBob

Well done.

What other plans do you have for the keypad ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

littlewolf


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.

CrossRoads

switch (customKey){
case 'a':
:
:
break;
case 'b':
:
:
break;
// etc.
}
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

littlewolf

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

Go Up