Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:a8a4092d05f4
diff -r 000000000000 -r a8a4092d05f4 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 10 22:44:53 2019 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+#include "C12832.h"
+
+C12832 lcd(p5, p7, p6, p8, p11); //establish communication with lcd
+
+InterruptIn UP(p15); // set. digital inputs p12-16 connected to joystick
+InterruptIn DN(p12);
+InterruptIn LT(p13);
+InterruptIn RT(p16);
+InterruptIn CT(p14);
+
+
+int main() {
+
+ lcd.cls(); // clear lcd screen
+ lcd.locate(0,4); // set first line and 4 place for lcd
+ lcd.printf("Main loop OK"); // display control text
+
+
+ while(1) {
+ /* now we have five digital inputs, everytime when we press the joystick
+ we connect apriopiate pin to 3.3V (state HIGH = 1) and we repeat
+ the same sequence of code depend of chosen direction (UP, DN etc.)
+ */
+ if(UP==1) //check condition if UP button is pressed
+ {
+ lcd.cls(); //clear screen
+ lcd.locate(0,4); //set up position on lcd screen
+ lcd.printf("UP is pressed\n\r");
+ wait(0.2); // debouncing time
+ }
+ if(DN==1) //check condition if DN button is pressed
+ {
+ lcd.cls();
+ lcd.locate(0,4);
+ lcd.printf("DN pressed");
+ wait(0.2);
+ }
+ if(RT==1) //check condition if RT button is pressed
+ {
+ lcd.cls();
+ lcd.locate(0,4);
+ lcd.printf("Right pressed");
+ wait(0.2);
+ }
+ if(LT==1) //check condition if LT button is pressed
+ {
+ lcd.cls();
+ lcd.locate(0,4);
+ lcd.printf("Left pressed");
+ wait(0.2);
+ }
+ if(CT==1) //check condition if CT button is pressed
+ {
+ lcd.cls();
+ lcd.locate(0,4);
+ lcd.printf("Center pressed");
+ wait(0.2);
+ }
+ }
+}
+