Cell phone

Dependencies:   TFT_fonts mbed

Fork of Seeed_TFT_Touch_Shield by Shields

Files at this revision

API Documentation at this revision

Comitter:
aasshishkanade
Date:
Fri Sep 19 17:38:37 2014 +0000
Parent:
6:5cea8c6b9a1e
Commit message:
number stored, multiple tapping error

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5cea8c6b9a1e -r d0cf0f1411eb main.cpp
--- a/main.cpp	Fri Sep 19 17:03:56 2014 +0000
+++ b/main.cpp	Fri Sep 19 17:38:37 2014 +0000
@@ -213,8 +213,8 @@
 
 int main()
 {
-        int curr_x = 5;
-        int curr_y = 20;
+        int curr_x = 20;
+        int curr_y = 5;
         int flag = 100;
         //Configure the display driver
         TFT.background(Black);
@@ -222,9 +222,10 @@
         TFT.cls();
         point p;
         keypad();
-        int number[10];
+        char number[10];
         int in = 0;
-        
+        int j = 0;
+        printf("HELLO SCA<M\n");
         while(1) {
             TFT.set_font((unsigned char*) Arial24x23);
             while(TFT.getTouch(p) != YES && TFT.getTouch(p) != MAYBE);
@@ -252,7 +253,6 @@
                     }
                     else if((3300 < p.x && p.x < 4400) && (3300 < p.y && p.y < 4800)) {
                         flag = 5;
-                        number[in++] = flag;
                     }
                     else if((3300 < p.x && p.x < 4400) && (5300 < p.y && p.y < 6800)) {
                         flag = 6;
@@ -284,8 +284,6 @@
                     } 
                     else if((1000 < p.x && p.x < 2000) && (5300 < p.y && p.y < 6800)) {
                         flag = 20;
-                        if (in > 0)
-                            in--;
                     } 
                     else
                         flag = 100;
@@ -293,16 +291,18 @@
             
             TFT.locate(curr_y,curr_x);
             if (flag == 1) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
                 
             }
             else if (flag == 2) {
-                number[in++] = flag;
+               
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                 number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 3) {
@@ -312,57 +312,69 @@
                 wait_ms(30);
             }
             else if (flag == 4) {
-                number[in++] = flag;
+               
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                 number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 5) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 6) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 7) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 8) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 9) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 0) {
-                number[in++] = flag;
+                
                 TFT.printf("%i",flag);
                 curr_y += 15;
+                number[in++] = flag;
                 wait_ms(30);
             }
             else if (flag == 20) {
-                if (in > 0)
-                    in--;
-                if(curr_y > 20){
+                
+                if(curr_y > 5){
                     curr_y -= 15;
                     TFT.locate(curr_y,curr_x);
                     TFT.printf(" ");
+                    if (in > 0)
+                    in--;
                 }
                 wait_ms(30);
             }
+            else if (flag == 10) {
+                for (j=0;j<in;j++)
+                    printf("%i",number[j]);
+            }
             else {
             }
         }