rduino sketches

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

chucketn

Senior Citizen
Joined
Dec 17, 2009
Messages
1,326
Reaction score
167
Location
Near Jonesborough, TN
I'm in the process of combining snippets of working sketches into a single sketch
I'm getting an error that 'Keypad' does not name a type.

Funny thing is I copied the keypad info from a working sketch, that compiles and runs. In the new unfinished sketch the line

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

compiles in one and fails in the other.

I copied the following from the working sketch to the new one. It errors on the new one! Help?

#include <Keypad.h>
const byte rows = 4;
const byte cols = 4;
char keys[rows][cols] = {
{'1','2','3','B'},
{'4','5','6','L'},
{'7','8','9','R'},
{'*','0','#','E'}
};
byte rowPins[rows] = {11,10,9,8};
byte colPins[cols] = {7,6,5,4};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

Chuck
 
Well, I fixed it. don't know how...
I removed some comments from the top of the new file and it compiled with no errors! Strange, the comments were in the original sketch I was modifying...

Chuck
 
I'll bet it was an errant or missing // ; or { }
Syntax is my biggest stumbling block
Glad you got it sorted

Scott
 
Sounds like the compiler got confused and could not find the keypad.h file so was a library misconfiguration error. Had that a couple of times myself.
 
A few days ago I saw a result in a Google search that looked interesting, but I got involved in another result. Wouldn't you know, now I can't remember what that link was, or the particular search parameter that brought it up. It had something to do with assigning functions to key presses on a 4x4 matrix keypad, like 'Enter', or 'Back Space'. I would like to add a "Store the # entered' type function for what ever number I entered on the keyboard. Can anyone point me in the right direction? I can usually figure it out from a good example.

Chuck
 
A few days ago I saw a result in a Google search that looked interesting, but I got involved in another result. Wouldn't you know, now I can't remember what that link was, or the particular search parameter that brought it up. It had something to do with assigning functions to key presses on a 4x4 matrix keypad, like 'Enter', or 'Back Space'. I would like to add a "Store the # entered' type function for what ever number I entered on the keyboard. Can anyone point me in the right direction? I can usually figure it out from a good example.

Chuck
does this help

http://playground.arduino.cc/Main/KeypadTutorial
cheers
Luc
 
Thanks, Luc. You must be a mind reader...
I have been working on this for days. My software development skills leave a lot to be desired. I get so far and forget to save what I have working.
So far, I have a simple sketch that reads the 4x4 keypad, and displays on the LCD with the I2c serial module. Now back to figuring out how to get the # of divisions entered and stored, and transfer the stepper movement part of Chuck Fellows' sketch.

Chuck
 
Hi Chuck,
sometimes, when you use cut and paste you can include some "invisible" chars (newlines, strange symbols...); the editor doesn't show them but they are here and the compiler generates a syntax error.
If you completely delete the line and rewrite it by hand, without using cut and paste, that error disappears... :wall:
I saw this with both Arduino and Dev C++ compiler.

cheers

Roberto
 
Hi Chuck,
sometimes, when you use cut and paste you can include some "invisible" chars (newlines, strange symbols...); the editor doesn't show them but they are here and the compiler generates a syntax error.
If you completely delete the line and rewrite it by hand, without using cut and paste, that error disappears... :wall:
I saw this with both Arduino and Dev C++ compiler.

cheers

Roberto

That makes a lot of sense, Roberto! I have had better luck installing a new library by extracting or unzipping to a folder, then moving the folder to the library. Thanks for pointing that out.

Chuck
 

Latest posts

Back
Top