Chapter 22 Matrix Keypad
246
The library Keypad used for RPi is transplanted from the Arduino library Keypad. The source files is written by
language
C++
and
translated
to
Python
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:
c l ass K eypad
d e f
_ _init__
(
self
,
usrKeyMap
,
row_Pins
,
col_Pins
,
num_Rows
,
num_Cols
):
Constructed function, the parameters are: key code of keyboard, row pin, column pin, the number of rows,
the number of columns.
d e f
g etKey
(
self
):
Get a pressed key. If no key is pressed, the return value is keypad NULL.
d e f
s etDebounceTime
(
self
,
ms
):
Set the debounce time. And the default time is 10ms.
d e f
s etHoldTime
(
self
,
ms
):
Set the time when the key holds stable state after pressed.
d e f
i sPressed
(
keyChar
):
Judge wether the key with code "keyChar" is pressed.
d e f
w aitForKey
():
Wait for a key to be pressed, and return key code of the pressed key.
d e f
g etState
():
Get state of the keys.
d e f
k eyStateChanged
():
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.py".
Summary of Contents for Ultimate Starter Kit
Page 1: ...Free your innovation Freenove is an open source electronics platform www freenove com ...
Page 117: ...117 Chapter 9 Potentiometer RGBLED www freenove com support freenove com Hardware connection ...
Page 155: ...155 Chapter 14 Relay Motor www freenove com support freenove com Hardware connection OFF 3 3V ...
Page 173: ...173 Chapter 16 Stepping Motor www freenove com support freenove com Hardware connection ...
Page 239: ...239 Chapter 22 Matrix Keypad www freenove com support freenove com Circuit Schematic diagram ...
Page 240: ...Chapter 22 Matrix Keypad 240 www freenove com support freenove com Hardware connection ...