Go Down

Topic: Key.H (Read 671 times) previous topic - next topic

dcr_inc

Ok.. Nub here,
I got my rotary encoder to count and reset.. Thanks for all the suggestions..

Now I can't get the Keypad to work.. I have loaded the Keypad example sketchs from the Arduino software but I get errors each time I try to compile the script..
I notice the #include <keypad.h> is grayed out..Other sketches like LCD TEST have the #include <LiquidCrystal.h> in yellow and they work..
I have attempted to add the keypad library to my Arduino/Libraries folder.. It shows that it's there with the Key.h, keypad.cpp and key.h files as well..
What am I missing (besides patience and hair(pulling it out))?
This is the code I'am using.. Right from the included library

/* @file HelloKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates the simplest use of the matrix Keypad library.
|| #
*/
#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){
    Serial.println(key);
  }
}



The errors I get are:

HelloKeypad:23: error: 'Keypad' does not name a type
HelloKeypad.ino: In function 'void loop()':
HelloKeypad:30: error: 'keypad' was not declared in this scope


This is whats in my keypad folder:
KEYPAD
Key.h
Keypad.cpp
Keypad.h
Keypad_in_the_works
Keypad_in_the_works.ino
libraries
Keypad.cpp
Keypad.h
CustomKeypad
DynamicKeypad
EventKeypad
HelloKeypad
HelloKeypad3
loopCounter
MultiKey
readme.txt
Seconds_since_reset
CustomKeypad
CustomKeypad.ino
DynamicKeypad
EventKeypad
HelloKeypad
HelloKeypad3


Any help for this Nub would be appreciated
I'm Lost !! At least on the Arduino...

HazardsMind

Where did you put the files, in the arduino 1.0.2 folder or the sketch folder?
you might need to swap locations and restart the program
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

dcr_inc

Ok.. I have the Arduino program running on a PC now.. All seems to be oK.. The Keypad sketch compiles and behaves.. I have a MAC that I prefer to run Arduino on (my original problems were on the MAC).. I can not find the Arduino-1.0.1 folder on the MAC.. I find an Arduino folder in my documents folder but it only contains a sub folder of libraries with the preferences.Txt file in it..
Where would I find the arduino 1.0.1 folder with the actual libraries in them?
I'm Lost !! At least on the Arduino...

HazardsMind

I dont own a MAC, but did you try to do a full search of your folders for arduino 1.0.1?
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

dcr_inc

No Joy.. The only arduino reference anywhere on the drive is the arduino folder which does not have the same folders or files as the PC version does.. I really want to add Keypad to my library on the Imac.. :0 :0
I'm Lost !! At least on the Arduino...

Go Up