final

Dependencies:   MAX30003 max32630fthr DS1307

Revision:
27:3b45b47d735d
Parent:
26:c41e561a02de
--- a/main.cpp	Tue Dec 21 01:17:08 2021 +0000
+++ b/main.cpp	Sat Jan 22 01:42:50 2022 +0000
@@ -93,15 +93,13 @@
     DigitalOut RGBg(P1_1);
     DigitalOut RGBb(P1_0);
     
-    DigitalOut rLed(P0_6);
+    
     
-    rLed=1;
+   
     
     S0=0;   
     S1=0;
-    RGBr=0;
-    RGBg=1;
-    RGBb=1;
+   
     
 //    pc.baud(9600);
     
@@ -156,7 +154,8 @@
     uint8_t cksm_1 = 0;
     uint8_t cksm_2 = 0;
     //uint8_t header_device_id[3] = {0,0,210};   //OLD device ID
-    uint8_t header_device_id[3] = {0,0,12};     //
+   // uint8_t header_device_id[3] = {0,0,12};     //
+    uint8_t header_device_id[3] = {0,0,1};
     uint8_t header_packet_type[2] = {0,2};
     uint8_t battery_level[1] ={0};
     
@@ -200,7 +199,8 @@
     }
        else
         {
-             //printf("The timestamp is not divisible by 60 \n");
+         RGBr=1;
+         RGBg=1;
      }
      flag_first = true;
     
@@ -209,7 +209,7 @@
      }   while (timestamp_reader==false);  // take the third timestamp 
     
 //---------------------------------software RTC End---------------------------------------------//
- rLed=0;
+ 
   
 while(1) 
     {
@@ -224,7 +224,12 @@
        battery_level[0] = {output}; 
     else
         battery_level[0] ={99};
-    
+        
+        if (output <10 )
+         RGBr=1;
+         RGBg=1;
+         
+
     if ((onesec_counter>=125))
     {
       tic++;
@@ -286,18 +291,14 @@
      {
       S0=1; 
       S1=0;
-        RGBr=1;
-        RGBg=0;
-        RGBb=1;
+        
      channel_num[0]= {1};
      } 
      if (tic==120)    //C2
      {
       S0=0; 
       S1=1;
-        RGBr=1;
-        RGBg=1;
-        RGBb=0;
+        
       channel_num[0]= {2};
       }
          
@@ -305,9 +306,7 @@
      {
       S0=0; 
       S1=0;
-        RGBr=0;
-        RGBg=1;
-        RGBb=1;
+        
      channel_num[0]= {0};
      tic=0;} 
      
@@ -318,9 +317,7 @@
     {tic=185; 
       S0=0; 
       S1=0;
-        RGBr=0;
-        RGBg=1;
-        RGBb=1;
+        
       
     //  S2=0;
    //  S3=0;
@@ -330,10 +327,7 @@
      {tic=190;
       S0=1; 
       S1=0;
-        RGBr=1;
-        RGBg=0;
-        RGBb=1;
-      
+        
    //   S2=0;
     //  S3=0;
       channel_num[0]= {1};}
@@ -342,9 +336,7 @@
      {tic=200; 
       S0=0; 
       S1=1;
-        RGBr=1;
-        RGBg=1;
-        RGBb=0;
+        
       
    //   S2=0;
     //  S3=0;
@@ -380,7 +372,7 @@
                 if( ETAG[readECGSamples - 1] == FIFO_OVF_MASK )
                 {                  
                     ecgAFE.writeRegister( MAX30003::FIFO_RST , 0); // Reset FIFO
-                    rLed = 1;//notifies the user that an over flow occured
+                   //notifies the user that an over flow occured
                 }
                 //uint8_t header_ecg_checksum[2] = {'%','%'};
                 //pc.write((uint8_t *)header_ecg_checksum, sizeof(header_ecg_checksum));
@@ -412,7 +404,7 @@
                     onesec_counter++;      
                 } 
                   flip =!flip; 
-                  rLed = ! rLed;           
+                           
             }
            
         }