UwU
Dependencies: mbed TextLCD Keypad
Revision 25:d8698a7bc5be, committed 2019-11-14
- Comitter:
- gabocs
- Date:
- Thu Nov 14 20:59:42 2019 +0000
- Parent:
- 24:7f14b70fc9ef
- Commit message:
- OH;
Changed in this revision
diff -r 7f14b70fc9ef -r d8698a7bc5be Keypad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Keypad.lib Thu Nov 14 20:59:42 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/grantphillips/code/Keypad/#4bbd88022a6f
diff -r 7f14b70fc9ef -r d8698a7bc5be TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Nov 14 20:59:42 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r 7f14b70fc9ef -r d8698a7bc5be main.cpp --- a/main.cpp Mon Apr 08 11:03:25 2019 +0100 +++ b/main.cpp Thu Nov 14 20:59:42 2019 +0000 @@ -1,12 +1,24 @@ #include "mbed.h" +#include "Keypad.h" +#include "TextLCD.h" -DigitalOut myled(LED1); +TextLCD lcd(PTB9,PTA1,PTB23,PTA2,PTC2,PTC3); +Keypad kpad(PTC12,PTC4,PTD0,PTD2,PTD3,PTD1,PTE25,PTE24); +Serial pc(USBTX,USBRX); +int main(){ + char key; + int released = 1; -int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } -} + while(1){ + key = kpad.ReadKey(); //read the current key pressed + + if(key == '\0') + released = 1; //set the flag when all keys are released + + if((key != '\0') && (released == 1)) { //if a key is pressed AND previous key was released + pc.printf("%c\n", key); + released = 0; //clear the flag to indicate that key is still pressed + } + lcd.printf("%c",key); + } +} \ No newline at end of file