e. KeyPad

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 14 - CleO Utility Widgets >

e. KeyPad

This section shows how to use the KeyPad widget. You may use the KeyPad() command to get a keypad on screen.

 

 

Command Prototype

 

int16_t KeyPad(const char* prompt, int16_t Numeric)

 

Parameters

Description

Prompt

buffer to store String shown on the top of the Keypad

Numeric

default number shown in the keypad result

 

Code

 

 

void setup()

{

/ Initialize CleO - needs to be done only once /

 CleO.begin();

 

 int32_t numeric = 1234;

 

/ Draw Keypad /

 int16_t retcode = CleO.KeyPad("Enter PIN", numeric);

 

 String displayText = String(retcode);

 char buffer[10];

 displayText.toCharArray(buffer, 10);

 

/ Start building a screen frame /

 CleO.Start();

 

 CleO.StringExt(FONT_MEDIUM, 400, 240, LIGHT_GREEN, MM, 0, 0, buffer);

 

 / Display completed screen frame /

 CleO.Show();

 CleO.CaptureScreen("KeyPad_50.png", 0, 0, 800, 480);

}

 

void loop() {}

 

 

Description

 

The above code snippet shows how to start keypad using the KeyPad() command.

 

Note: Make sure to perform the screen calibration. For details, refer to Tutorial 19 - Miscellaneous Commands > a. Screen Calibration.

 

 

Output

 

Here is the output displayed upon executing the code snippet -

 

Tutorials14-KeyPad