Test InterruptIn without debouncing buttons. Lab 1

Dependencies:   mbed C12832

Files at this revision

API Documentation at this revision

Comitter:
Dariusz_Piskorowski
Date:
Sat Aug 10 22:41:30 2019 +0000
Commit message:
Test InterruptIn without debouncing buttons Rev.1

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Sat Aug 10 22:41:30 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/askksa12543/code/C12832/#990d5eec2ef6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Aug 10 22:41:30 2019 +0000
@@ -0,0 +1,56 @@
+#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.printf("UP is pressed\n\r");  //print text on lcd
+        
+        }
+        if(DN==1)                     //check condition if DN button is pressed 
+        {
+        
+        lcd.printf("DN pressed");     //print text on lcd    
+          
+        }
+        if(RT==1)                     //check condition if RT button is pressed 
+        {
+        
+        lcd.printf("Right pressed");  //print text on lcd
+        
+        }
+        if(LT==1)                     //check condition if LT button is pressed 
+        {
+        
+        lcd.printf("Left pressed");   //print text on lcd
+        
+        }
+        if(CT==1)                     //check condition if CT button is pressed 
+        {
+        
+        lcd.printf("Center pressed"); //print text on lcd
+        
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Aug 10 22:41:30 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file