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.
main.cpp
00001 #include "mbed.h" 00002 char buffer[255]; 00003 int empty = 0; 00004 void datain(); 00005 void datain(void){ 00006 if(empty == 0){ 00007 scanf("%s", &buffer); 00008 wait(0.1); 00009 } 00010 } 00011 void readalldata(); //displays date, tim, temperature, presure, ligt 00012 void deletealldata(); //deletes all memory from th iternal memory 00013 void readn();//returns past <n> records 00014 void setdate(); //sets the day month and year 00015 void settime(); //sets the clock hours, minutes, seconds 00016 void setT(); //sets the sampling period to <T> seconds 00017 void stateon(); //turns ampling ON and OFF 00018 void stateoff(); //turns ampling ON and OFF 00019 void help(); 00020 void loggingon(); 00021 void loggingoff(); //turns diagnostic logging ON and OFF 00022 void deleten();//deletes the <n> records 00023 void readdata(); 00024 void printcommandlist(); 00025 void printcommandlist(){ 00026 printf("Command List:\n\r READALL\n\r DELETEALL\n\r READ_N\n\r SETDATE\n\r SETTIME\n\r SETT\n\r STATEON(Sampling State)\n\r STATEOFF(Sampling State)\n\r LOGGINGON\n\r LOGGINGOFF\n\r COMMANDLIST\n\r" ); 00027 } 00028 void readdata(){ 00029 if (buffer != ""){ 00030 if (strstr(buffer, "READALL")){ 00031 readalldata(); 00032 } 00033 else if(strstr(buffer, "COMMANDLIST")){ 00034 printcommandlist(); 00035 } 00036 else if(strstr(buffer, "HELP")){ 00037 help(); 00038 } 00039 else if(strstr(buffer, "DELETEALL")){ 00040 deletealldata(); 00041 } 00042 else if(strstr(buffer, "READ_N")){////////COME BACK HERE LATE 00043 readn(); 00044 } 00045 else if(strstr(buffer, "SETDATE")){////////COME BACK HERE LATE 00046 setdate(); 00047 } 00048 else if(strstr(buffer, "SETTIME")){////////COME BACK HERE LATE 00049 settime(); 00050 } 00051 else if(strstr(buffer, "SETT")){////////COME BACK HERE LATE 00052 setT(); 00053 } 00054 else if(strstr(buffer, "STATEON")){ 00055 stateon(); 00056 } 00057 else if(strstr(buffer, "STATEOFF")){ 00058 stateoff(); 00059 } 00060 else if(strstr(buffer, "LOGGINGON")){ 00061 loggingon(); 00062 } 00063 else if(strstr(buffer, "LOGGINGOFF")){ 00064 loggingoff(); 00065 } 00066 else if(strstr(buffer, "DELETEN")){///////COME BACK HERE LATE 00067 deleten(); 00068 } 00069 else 00070 { 00071 printf("UNRECOGNISED\n\r"); 00072 } 00073 } 00074 } 00075 00076 00077 void help(){ 00078 printf("HELP: \n\rFOR COMMAND LIST, type COMMANDLIST\n\r"); 00079 } 00080 void readalldata(){ 00081 printf("read all data\n\r"); 00082 } //displays date, tim, temperature, presure, ligt 00083 void deletealldata(){ 00084 printf("delete all data \n\r"); 00085 } //deletes all memory from th iternal memory 00086 void readn(){ 00087 printf("read all user defined records\n\r"); 00088 }//returns past <n> records 00089 void deleten() 00090 { 00091 printf("Delete Oldest Record\n\r"); 00092 }//deletes the <n> records 00093 void setdate(){ 00094 printf("Set Date\n\r"); 00095 } //sets the day month and year 00096 void settime(){ 00097 printf("Set Time\n\r"); 00098 } //sets the clock hours, minutes, seconds 00099 void setT() 00100 { 00101 printf("Set Sampling Period 'T'\n\r"); 00102 } //sets the sampling period to <T> seconds 00103 void stateon(){ 00104 printf("Set Sampling ON\n\r"); 00105 } //turns ampling ON and OFF 00106 void stateoff(){ 00107 printf("Set Sampling OFF\n\r"); 00108 } 00109 void loggingon(){ 00110 00111 printf("Logging On\n\r"); 00112 } 00113 void loggingoff(){ 00114 00115 printf("Logging Off\n\r"); 00116 } 00117 //turns diagnostic logging ON and OFF 00118 int main(){ 00119 00120 help(); 00121 while(true){ 00122 datain(); 00123 readdata(); 00124 } 00125 } 00126
Generated on Sat Jul 16 2022 11:46:52 by
1.7.2