Saver nodo

Dependencies:   ds3231 sd-driver-master

Files at this revision

API Documentation at this revision

Comitter:
SolManB
Date:
Wed Jul 11 23:46:48 2018 +0000
Parent:
0:6c5b9198f119
Commit message:
Attach

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jun 15 03:58:21 2018 +0000
+++ b/main.cpp	Wed Jul 11 23:46:48 2018 +0000
@@ -16,7 +16,7 @@
 FATFileSystem fs("fs");
 Serial xbee(p13,p14);
 
-Thread Lectura;
+Ticker Lectura;
 
 Timer t;
 time_t epoch_time;
@@ -80,8 +80,6 @@
 
 void Lect()
 {
-    while(1)
-    {
         ax=x.read_u16();
         ay=y.read_u16();
         az=z.read_u16();
@@ -97,11 +95,12 @@
         milis=t.read_ms();
 
         //Sensor de temperatura
-        int b=0;
+        /*int b=0;
         if(b1<b2)
             b=b1/10;
         else
-            b=b2/10;
+            b=b2/10;*/
+    
         sprintf(dato1,"%d\t%d\t%d\t%s\t%d\n",ax,ay,az,fecha,milis);   
         //sprintf(dato,"%c%c%c%c%c%c%c%c",(int)(ax/256),(int)(ax%256),(int)(ay/256),(int)(ay%256),(int)(az/256),(int)(az%256),(b),(char)((int)(milis/10)));
         //envio();
@@ -121,8 +120,8 @@
         i=0;
         led2=!led2;
     }
-        Thread::wait(9);
-    }
+        
+    
 }
 
 int main()
@@ -130,8 +129,7 @@
     sd.init();
     fs.mount(&sd);
     xbee.baud(115200);
-    pc.baud(921600);
-    Lectura.start(callback(Lect));
+    Lectura.attach(&Lect,0.01);
     while(1)
     {}
     sd.deinit();