LCD contadores

Dependencies:   Debounced TextLCDjj mbed

Files at this revision

API Documentation at this revision

Comitter:
jomapi
Date:
Mon Nov 18 20:00:42 2013 +0000
Commit message:
tarea1_JJ

Changed in this revision

Debouncedjj.lib Show annotated file Show diff for this revision Revisions of this file
TextLCDjj.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/Debouncedjj.lib	Mon Nov 18 20:00:42 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/WarwickRacing/code/Debounced/#8992c13bbb9b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCDjj.lib	Mon Nov 18 20:00:42 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/jomapi/code/TextLCDjj/#93f7542139b7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 18 20:00:42 2013 +0000
@@ -0,0 +1,145 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "DebouncedIn.h"
+
+TextLCD LCD(PTC10, PTC11, PTC12, PTC13, PTC16, PTC17); // rs, e, d4-d7
+DebouncedIn mas(PTE2);
+DebouncedIn menos(PTE3);
+DebouncedIn salto(PTE4);
+
+int main() {
+
+    LCD.cls();
+    LCD.locate(0,0);
+    LCD.printf("Sp:");
+    
+    LCD.locate(9,0);
+    LCD.printf("Kp:");
+    
+    LCD.locate(0,1);
+    LCD.printf("Ki:");
+    
+    LCD.locate(9,1);
+    LCD.printf("Kd:");
+    
+    //LCD.writeCommand(0x0F);
+    
+    int i=0;
+    int j=0;
+    int k=0;
+    int l=0;
+    int m=0;
+    while(1) {
+       if (salto.falling()){
+          ++i;
+          if (i>3){
+            i=0;
+          }
+       }
+       
+       if (i==0){
+          LCD.locate(2,0);
+          LCD.printf(":");
+          LCD.writeCommand(0x0F);  
+          LCD.printf("%d", j);
+          if (mas.falling()){
+          LCD.locate(3,0);
+          
+           j++;
+           LCD.printf("%d", j);
+          }   
+          if (menos.falling()){
+          LCD.locate(3,0);
+          LCD.printf("   ");
+          LCD.locate(3,0);
+           --j;
+         
+           if (j<1){
+             j=0;
+              LCD.locate(3,0);
+              LCD.printf("   ");
+              LCD.locate(3,0);
+              LCD.printf("%d", j);
+              LCD.writeCommand(0x0F);  
+              
+            }
+           LCD.printf("%d", j);
+          }  
+       }
+       
+        if (i==1){
+          LCD.locate(11,0);
+          LCD.printf(":");
+          LCD.writeCommand(0x0F);   
+         
+           LCD.printf("%d", k);
+          if (mas.falling()){
+          LCD.locate(12,0);
+           k++;
+           LCD.printf("%d", k);
+          }        
+          if (menos.falling()){
+          LCD.locate(12,0);
+           --k;
+           
+           if (k<1){
+             k=0;
+              LCD.locate(12,0);
+              LCD.printf("%d", k);
+              LCD.writeCommand(0x0F);  
+              
+           }
+           LCD.printf("%d", k);
+          }
+        if (i==2){
+          LCD.locate(2,1);
+          LCD.printf(":");
+          LCD.writeCommand(0x0F); 
+            
+            if (mas.falling()){
+          LCD.locate(3,1);
+           l++;
+           LCD.printf("%d", l);
+          }   
+          if (menos.falling()){
+          LCD.locate(3,1);
+           --l;
+         
+           if (l<1){
+             l=0;
+              LCD.locate(3,1);
+              LCD.printf("%d", l);
+              LCD.writeCommand(0x0F);  
+              
+           }
+           LCD.printf("%d", l);
+          }  
+       }
+       }
+        if (i==3){
+          LCD.locate(11,1);
+          LCD.printf(":");
+          LCD.writeCommand(0x0F);
+          if (mas.falling()){
+          LCD.locate(12,1);
+           m++;
+           LCD.printf("%d", m);
+          }        
+          if (menos.falling()){
+          LCD.locate(12,1);
+           --m;
+           
+           if (m<1){
+             m=0;
+              LCD.locate(12,1);
+              LCD.printf("%d", m);
+              LCD.writeCommand(0x0F);  
+              
+           }
+           LCD.printf("%d", m);         
+       }
+        wait(0.2);
+       
+    }
+}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 18 20:00:42 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file