soft253

Dependencies:   LPS25H hts221

Fork of SOFT253_Assignment by lucas kovaci

Files at this revision

API Documentation at this revision

Comitter:
akovaci
Date:
Sat May 13 00:48:10 2017 +0000
Parent:
37:b62b3aa19645
Commit message:
PANOS

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b62b3aa19645 -r 8b6a6927b4f2 main.cpp
--- a/main.cpp	Fri May 12 22:09:40 2017 +0000
+++ b/main.cpp	Sat May 13 00:48:10 2017 +0000
@@ -13,8 +13,13 @@
 
 float tempCelsius = 25.50;
 float humi = 55;
-int humiMax = 100; 
-char cmd=0;
+int humiMax = 100;
+char cmd[20];
+char cmd2[20];
+char s1[20];
+char s11[20];
+char s2[20];
+char s22[20];
 float tempArray[N];
 float humArray[N];
 float pressArray[N];
@@ -65,7 +70,7 @@
          //pc.printf("Temperature,Humidity,Pressure\n\n");
    while(1) 
    {  
-        cmd=NULL;
+        
          osEvent evt = mail_box.get();
         if (evt.status == osEventMail) 
         { 
@@ -90,17 +95,38 @@
 
 void threadcomun (void const *args)
 {
+ int ret;
+  int ret2;
+
          pc.baud(115200);
          pc.printf("Temperature,Humidity,Pressure\n\n");
-         while(cmd==NULL){cmd=getchar();}
-             if(cmd=='A')
-             {
+         //while(cmd==NULL){cmd=getchar();}
+         while(1){
+         scanf("%s%s",&cmd,&cmd2);
+        
+         //pc.printf("YOU ENTERED: %s \n",cmd);
+            strcpy (s1,cmd);
+            strcpy (s11,cmd2);
+            strcpy (s2,"READ");
+            strcpy (s22,"ALL");
+            ret = strncmp(s1,s2,20);
+            ret = strncmp(s11,s22,20);
+           
+            if (ret==0 && ret2==0)
+            {
+             
                for (unsigned int n=0; n<N; n++)
                 {
                   pc.printf("the element of %d is %4.2f\n\r ",n,tempArray[n]);
-                 //wait(1.0);
-                }
-              }
+                  
+                // wait(1.0);
+               }
+            }
+            else
+            {
+                pc.printf("error re mlk:  %s\n",cmd);
+             }
+             }
  
  }
  char answer;
@@ -116,7 +142,7 @@
     //threadcomun();
     
     //Thread thread(threadcomun);
-    t.attach(&adcISR,1);
+    t.attach(&adcISR,5); // timer of measurements 
     
     while(1) 
     {