/*############################################################# Program Name : ex1_KEYPAD_DISCO_F429I_Simple Author : Grant Phillips Date Modified : 10/05/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Example program that demonstrates the use of the KEYPAD_DISCO_F429I class to implement a 4x4 keypad on the STM32F429I-Discovery board. The default colors and keys characters are used in this example. Requirements : * STM32F4-Discovery Board Circuit : * NONE ##############################################################*/ // #include "mbed.h" #include "TS_DISCO_F429ZI.h" #include "LCD_DISCO_F429ZI.h" #include "KEYPAD_DISCO_F429ZI.h" KEYPAD_DISCO_F429ZI keypad; int main() { char buf[20]; //string variable char k, key; keypad.Show(1, 1); //Display the keypad, enable the Message and Output Box areas keypad.WriteMsgBoxLine(0, "Press any key..."); //display a message in the keypad.WriteMsgBoxLine(1, "----------------"); //Message Box area of the keypad while(1) { k = keypad.ReadKey(); //read the current key pressed if(k != '\0') { //if a key is pressed key = k; //store the key in a variable do //read until key is released k = keypad.ReadKey(); while(k != '\0'); sprintf(buf, "%c was pressed", key); keypad.WriteOutBox(buf); //display result in Output Box area of keypad } } }