newest
Dependencies: BME280 BMP280 TextLCD mbed
Fork of CW_watchdog_08012018_newest by
Diff: putty.h
- Revision:
- 1:dc21a6fce3af
- Parent:
- 0:7023c3f98f36
- Child:
- 2:c696dfd53eeb
--- a/putty.h Sat Jan 06 17:28:05 2018 +0000 +++ b/putty.h Mon Jan 08 18:46:57 2018 +0000 @@ -3,7 +3,7 @@ Serial pc(USBTX, USBRX); char user_command[40] = {0}; char user_command2[40] = {0}; -int n, datan = 0, datac = 0, counterd = 0, dates, times, interrupt = 0; +int n, datan = 0, datac = 0, counterd = 0, dates, times, interrupt = 0, gather_data = 1; float t; @@ -13,7 +13,7 @@ pc.printf("readall selected\n\r"); if (full == 1) { - datac = 120; + datac = 119; } else { @@ -22,10 +22,10 @@ pc.printf("printting %i datas\n\r", datac); while (counterd < datac) { - pc.printf("light: %2.4f, temp: %3.4f, press: %3.4f\n\r", data_light[datan], data_temp [datan], data_press[datan]); + pc.printf("%i%i:%i%i:%i%i, %i%i/%i%i/%i%i%i%i, light: %2.4f, temp: %3.4f, press: %3.4f\n\r", date0_a[datan-1] ,date_a[datan-1], time0_a[datan-1], time_a[datan-1],data_light[datan-1], data_temp [datan-1], data_press[datan-1]); if (datan == 0) { - datan = 121; + datan = 119; } datan--; counterd++; @@ -47,7 +47,7 @@ { while (counterd < n) { - pc.printf("light: %2.4f, temp: %3.4f, press: %3.4f\n\r",data_light[datan], data_temp [datan], data_press[datan]); + pc.printf("%i%i:%i%i:%i%i, %i%i/%i%i/%i%i%i%i,, light: %2.4f, temp: %3.4f, press: %3.4f\n\r", date0_a[datan-1] ,date_a[datan-1], time0_a[datan-1], time_a[datan-1], data_light[datan], data_temp [datan], data_press[datan]); if (datan == 0) { datan = 121; @@ -63,11 +63,15 @@ pc.printf("deleted %i datas \n\r", counterw); counterw = 0; int counter = 0; - while (counter < 121) + while (counter < 120) { data_light[counter] = 0; data_temp [counter] = 0; data_press[counter] = 0; + date_a[counter] = 0; + time_a[counter] = 0; + date0_a[counter] = 0; + time0_a[counter] = 0; counter ++; full = 0; } @@ -95,6 +99,10 @@ data_light[datan] = 0; data_temp [datan] = 0; data_press[datan] = 0; + date_a[datan] = 0; + time_a[datan] = 0; + date0_a[datan] = 0; + time0_a[datan] = 0; counterd ++; datan--; } @@ -107,7 +115,11 @@ { data_light[datan] = 0; data_temp [datan] = 0; - data_press[datan] = 0; + data_press[datan] = 0; + date_a[datan] = 0; + time_a[datan] = 0; + date0_a[datan] = 0; + time0_a[datan] = 0; counterd ++; datan--; } @@ -217,8 +229,28 @@ else if (user_command[0] == 'S'&& user_command[1] == 'E'&& user_command[2] == 'T'&& user_command[3] == 'T') { t = atof(user_command2); - pc.printf("you set the period to %2.2f", t); - interrupt = 1; + if (t <=60 && t>=0.1) + { + pc.printf("you set the period to %2.2f\n\r", t); + interrupt = 1; + } + else + { + pc.printf("out of range\n\r"); + } + } + else if (user_command[0] == 'S'&& user_command[1] == 'T'&& user_command[2] == 'A'&& user_command[3] == 'T'&& user_command[4] == 'E') + { + if (user_command2[0] == 'O'&& user_command2[1] == 'N') + { + gather_data = 1; + pc.printf("data is on\n\r"); + } + else if (user_command2[0] == 'O'&& user_command2[1] == 'F'&& user_command2[2] == 'F') + { + gather_data = 0; + pc.printf("data is off\n\r"); + } } } //int main()