escaner RF - RTOS multitareas

Dependencies:   mbed Servo MFRC522_Updated HC-SR04 ssd1306_library

Files at this revision

API Documentation at this revision

Comitter:
20172573073
Date:
Wed Jun 10 16:24:24 2020 +0000
Parent:
2:ad8f0cdf7015
Commit message:
ex

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ad8f0cdf7015 -r e7eaa479e804 main.cpp
--- a/main.cpp	Wed Jun 10 15:41:43 2020 +0000
+++ b/main.cpp	Wed Jun 10 16:24:24 2020 +0000
@@ -52,13 +52,11 @@
             myservo = i/40.0;
             da  = sonar.getCm();
             w=i;
-            //pc.printf("%1.f  ,  %.2f \n\r",float(i*4.5),da);
             if(menor > da) {
                 menor = da;
                 a=(i*180)/40;
             }
-            //ThisThread::sleep_for(500);
-            wait(0.05);
+           Thread::wait(50);
         }
         menor=sonar.getCm();
         a=0;
@@ -66,13 +64,11 @@
             myservo = i/40.0;
             da = sonar.getCm();
               w=i;
-            // pc.printf("%1.f  ,  %.2f \n\r",float(i*4.5),da);
             if(menor > da) {
                 menor = da;
                 a=(i*180)/40;
             }
-            //ThisThread::sleep_for(500);
-            wait(0.05);
+            Thread::wait(50);
         }
     }
 }
@@ -90,25 +86,22 @@
         display2=0;
         display3=0;
         display7Seg=anodeComun[d];
-
-        //ThisThread::sleep_for(25);
-        wait(0.003);
+        
+        Thread::wait(3);
 
         display1=0;
         display2=1;
         display3=0;
         display7Seg=anodeComun[u];
 
-        //ThisThread::sleep_for(25);
-        wait(0.003);
+        Thread::wait(3);
 
         display1=0;
         display2=0;
         display3=1;
         display7Seg=anodeComun[c];
 
-        //ThisThread::sleep_for(25);
-        wait(0.003);
+        Thread::wait(3);
 
 
     }
@@ -127,8 +120,8 @@
         time_t seconds = time(NULL);
         lcd.printf("Fecha= %s", ctime(&seconds));
         lcd.redraw();
-        //ThisThread::sleep_for(500);
-        wait(0.5);
+        
+        Thread::wait(500);
     }
 }
 void rf()
@@ -139,13 +132,13 @@
         lcd.init();
         lcd.speed (SSD1306::Fast);
         if ( ! RfChip.PICC_IsNewCardPresent()) {
-            //ThisThread::sleep_for(500);
-            wait_ms(500);
+            
+            Thread::wait(500);
             continue;
         }
         if ( ! RfChip.PICC_ReadCardSerial()) {
-            //ThisThread::sleep_for(500);
-            wait_ms(500);
+         
+            Thread::wait(500);
             continue;
         }
         uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak);
@@ -170,7 +163,7 @@
         }
      
         //ThisThread::sleep_for(1000);
-        wait_ms(1000);
+        Thread::wait(1000);
     }
 }
 void serial()
@@ -195,13 +188,13 @@
                    pc.printf("sin lectura"); 
                     }  
         pc.printf("\n\r");
-        wait(0.04);
+        Thread::wait(40);
         
     }
 }
 int main()
 {
-    myservo.calibrate(0.0015,360);
+    myservo.calibrate(0.0015,180);
     set_time(1591673863);
     RfChip.PCD_Init();
     t.start((servo));