Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SOFT253_Assignment by
Revision 38:8b6a6927b4f2, committed 2017-05-13
- 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 |
--- 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)
{
