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: mbed-os
Fork of z_compare_commands by
Revision 5:63aa16394fdb, committed 2018-01-06
- Comitter:
- eawhite
- Date:
- Sat Jan 06 13:07:01 2018 +0000
- Parent:
- 4:d03967db9991
- Commit message:
- Updated to get rid of un-needed for-loops. All commands are recognised.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d03967db9991 -r 63aa16394fdb main.cpp --- a/main.cpp Sat Jan 06 02:15:13 2018 +0000 +++ b/main.cpp Sat Jan 06 13:07:01 2018 +0000 @@ -41,9 +41,9 @@ float Tmin = 0.1; float setT; string command8 = "STATE"; -int stateX =0; +bool stateX = false; string command9 = "LOGGING"; -int logX = 0; +bool logX = false; RawSerial pc(USBTX, USBRX, 9600); @@ -74,6 +74,7 @@ if (c == '\r') { + greenLED = !greenLED; string rxBufferSTR = rxBuffer; int c = rxBufferSTR.length(); @@ -150,15 +151,10 @@ stringstream ss; for (int z = 0; z < sizeof(puttyNum) / sizeof(puttyNum[0]); z++) { ss << puttyNum[z]; - } - ss >> setDay; - for (int z = 0; z < sizeof(puttyNum) / sizeof(puttyNum[0]); z++) { - ss << puttyNum[z]; + pc.printf("%c", puttyNum[z]); } + ss >> setDay; ss >> setMonth; - for (int z = 0; z < sizeof(puttyNum) / sizeof(puttyNum[0]); z++) { - ss << puttyNum[z]; - } ss >> setYear; printf("DATE UPDATED TO %i.%i.%i\n", setDay, setMonth, setYear); } @@ -181,13 +177,7 @@ ss << puttyNum[z]; } ss >> setHour; - for (int z = 0; z < sizeof(puttyNum) / sizeof(puttyNum[0]); z++) { - ss << puttyNum[z]; - } ss >> setMinute; - for (int z = 0; z < sizeof(puttyNum) / sizeof(puttyNum[0]); z++) { - ss << puttyNum[z]; - } ss >> setSecond; printf("TIME UPDATED TO %i.%i.%i\n", setHour, setMinute, setSecond); } @@ -217,7 +207,7 @@ printf("T UPDATED TO %6.4f\n", setT); } else { - printf("OUT OF RANGE\n"); + printf("TIME OUT OF RANGE\n"); } }