Loading...
Pages: 1 [2]   Go Down
Author Topic: 8/8 button matrix  (Read 435 times)
0 Members and 1 Guest are viewing this topic.
Queens, New York
Offline Offline
Edison Member
*
Karma: 29
Posts: 1590
"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

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Global Moderator
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13896
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
Edison Member
*
Karma: 49
Posts: 1436
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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 316
Posts: 35593
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
Melbourne, Australia
Offline Offline
Shannon Member
*****
Karma: 219
Posts: 13896
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
Edison Member
*
Karma: 49
Posts: 1436
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

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: 249
Posts: 16574
Available for Design & Build services
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

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
Print
 
Jump to: