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.
Dependencies: X_NUCLEO_IKS01A1-f255a2c75ecb mbed-rtos mbed
Revision 37:886dcde018ad, committed 2016-05-18
- Comitter:
- Jacinta
- Date:
- Wed May 18 11:40:30 2016 +0000
- Parent:
- 36:0e30191d7db6
- Commit message:
- commited revision
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
userMethods.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed May 18 11:10:28 2016 +0000 +++ b/main.cpp Wed May 18 11:40:30 2016 +0000 @@ -90,7 +90,7 @@ printf("Sampling started...\n"); printf("\n\rWelcome! Type one of the following commands and press space or enter"); - printf("\n\ Don't forget to use only capitals when typing the commands!"); + printf("\n\r Don't forget to use only capitals when typing the commands!"); printf("\n\r READ ALL\n\r READ <n>\n\r DELETE ALL\n\r DELETE <n>"); printf("\n\r SETDATE dd mm yyyy\n\r SETTIME hh mm ss"); printf("\n\r SETT <T>\n\r STATE <x>\n\r LOGGING <x>\n\r EXIT\n\n\r"); @@ -102,7 +102,6 @@ Ticker ticker; ticker.attach(&sampleData, e.T); - char command[20]; char arg[10]; @@ -124,7 +123,7 @@ else perror("The argument is invalid\n\r"); } -/////////////////////////////////////////////////////////////////////////////////////////////////////// + else if (strcmp("DELETE", command)==0) { scanf("%s", arg); printf("\n"); @@ -142,7 +141,7 @@ else perror("The argument is invalid\n\r"); } -//////////////////////////////////////////////////////////////////////////////////// + else if (strcmp("SETDATE", command)==0) { char day[2], month[2], year[4]; //Read day @@ -196,7 +195,7 @@ printf("\n"); if (atof(arg) >= 0.1 && atof(arg) <= 60.0 ) { e.T = atof(arg); - //ticker.attach(e.sampleData,e.T); + ticker.attach(sampleData,e.T); printf("T UPDATED TO %.1f", e.T); } else perror ("Value must be between 1 and 60"); @@ -206,10 +205,10 @@ scanf("%s", arg); printf("\n"); if (strcmp("ON", arg)==0) { - //ticker.attach(e.sampleData, e.T); + ticker.attach(sampleData, e.T); printf("SAMPLING ON"); } else if (strcmp("OFF", arg)==0) { - //ticker.detach(); + ticker.detach(); printf("SAMPLIG OFF"); } @@ -220,10 +219,17 @@ else if(strcmp("LOGGING", command)==0) { scanf("%s", arg); printf("\n"); - if (strcmp("ON", arg)==0) + if (strcmp("ON", arg)==0){ + printf("Diagnostics ON"); flag= true; - else if (strcmp("OFF", arg)==0) + + } + else if (strcmp("OFF", arg)==0){ + + printf("Diagnostics OFF"); flag= false; + + } else perror ("The argument is invalid\n\r"); }
--- a/userMethods.cpp Wed May 18 11:10:28 2016 +0000 +++ b/userMethods.cpp Wed May 18 11:40:30 2016 +0000 @@ -15,6 +15,7 @@ // Method that processes the ReadAll command void UserMethods::readAllData(const void*) { + printf("Chegei"); vector<log_data> vector = *logVector; if(flag) printf("Entered in readAllData"); @@ -29,6 +30,8 @@ //.csv friendly format for logging printf("%s,%7s°C,%smbar,%s%%\n\r", ctime(&vector[i].date), ExpansionBoard::printDouble(buffer, vector[i].tempCelsius, 2), ExpansionBoard::printDouble(buffer, vector[i].pressure, 2), ExpansionBoard::printDouble(buffer, vector[i].humidity, 2)); + + Thread::wait(1000); } // Method to proccess Read <n> command