-
Notifications
You must be signed in to change notification settings - Fork 2
Keypad
Victor Carreño edited this page Jan 27, 2015
·
2 revisions
This section contains a simulated "matrix style keypad". The keypad sends a message to the Arduino every time a button is pressed. A method called getKeypadData(), returns the current char value but just one time. If you use this method again (in the same loop) it returns '/'. Also you can store this char in a local variable in case you need to use the value more than one time in a loop.
Functions
char getKeypadData()
Syntax
myiShield.getKeypadData()
Returns
char value.
| Keypad button (iOS App) | Char in Arduino |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 0 | 0 |
| . | . |
| A | a |
| B | b |
| C | c |
| Enter | e |
| Delete (<) | i |
Parameters
None
Example
#include <boards.h>
#include <SPI.h>
#include <RBL_nRF8001.h>
#include "iShield.h"
iShield myiShield;
void setup()
{
// Init. and start BLE library.
ble_begin();
Serial.begin(9600);
}
void loop()
{
myiShield.getInbox();
char currentChar;
currentChar = myiShield.getKeypadData();
if(currentChar != '/'){
Serial.println(currentChar);
}
}