EasyManuals Logo

Freenove Ultimate Starter Kit User Manual

Freenove Ultimate Starter Kit
286 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #243 background imageLoading...
Page #243 background image
243
Chapter 22 Matrix Keypad
www.freenove.com
support@freenove.com
In the "while" cycle, use the function key= keypad.getKey () to read the keyboard constantly. If there is a key
pressed, its key code will be stored in the variable "key", then be printed out.
w hile(1){
key = keypad. getKey(); //get the state of keys
if (key){ // if a key is pressed, print out its key code
printf("You Pressed key : %c \n", key);
}
}
The library Keypad used for RPi is transplanted from the Arduino library Keypad. And the source files can be
obtained by visiting http://playground.arduino.cc/Code/Keypad. As for transplanted function library, the
function and method of all classes, functions, variables, etc. are the same as the original library. Partial contents
of the Keypad library are described below:
cl ass K eypad
Ke ypad(char *userKeymap, byte *row, byte * col, b yte n umRows, byte numCols);
Constructor, the parameters are: key code of keyboard, row pin, column pin, the number of rows, the
number of columns.
ch ar getKey();
Get the key code of the pressed key. If no key is pressed, the return value is NULL.
vo id setDebounceTime(uint);
Set the debounce time. And the default time is 10ms.
vo id setHoldTime(uint);
Set the time when the key holds stable state after pressed.
bo ol isPressed(char keyChar);
Judge wether the key with code "keyChar" is pressed.
ch ar waitForKey();
Wait for a key to be pressed, and return key code of the pressed key.
Ke yState g etState();
Get state of the keys.
bo ol keyStateChanged();
Judge whether there is a change of key state, then return True or False.
For More information about Keypad, please visit: http://playground.arduino.cc/Code/Keypad or through the
opening file "Keypad.hpp".

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove Ultimate Starter Kit and is the answer not in the manual?

Freenove Ultimate Starter Kit Specifications

General IconGeneral
BrandFreenove
ModelUltimate Starter Kit
CategorySingle board computers
LanguageEnglish