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.
Diff: main.cpp
- Revision:
- 0:df28c66b6d9e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jan 09 00:33:45 2018 +0000
@@ -0,0 +1,126 @@
+#include "mbed.h"
+char buffer[255];
+int empty = 0;
+void datain();
+void datain(void){
+ if(empty == 0){
+ scanf("%s", &buffer);
+ wait(0.1);
+ }
+ }
+void readalldata(); //displays date, tim, temperature, presure, ligt
+void deletealldata(); //deletes all memory from th iternal memory
+void readn();//returns past <n> records
+void setdate(); //sets the day month and year
+void settime(); //sets the clock hours, minutes, seconds
+void setT(); //sets the sampling period to <T> seconds
+void stateon(); //turns ampling ON and OFF
+void stateoff(); //turns ampling ON and OFF
+void help();
+void loggingon();
+void loggingoff(); //turns diagnostic logging ON and OFF
+void deleten();//deletes the <n> records
+void readdata();
+void printcommandlist();
+void printcommandlist(){
+ 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" );
+ }
+void readdata(){
+ if (buffer != ""){
+ if (strstr(buffer, "READALL")){
+ readalldata();
+ }
+ else if(strstr(buffer, "COMMANDLIST")){
+ printcommandlist();
+ }
+ else if(strstr(buffer, "HELP")){
+ help();
+ }
+ else if(strstr(buffer, "DELETEALL")){
+ deletealldata();
+ }
+ else if(strstr(buffer, "READ_N")){////////COME BACK HERE LATE
+ readn();
+ }
+ else if(strstr(buffer, "SETDATE")){////////COME BACK HERE LATE
+ setdate();
+ }
+ else if(strstr(buffer, "SETTIME")){////////COME BACK HERE LATE
+ settime();
+ }
+ else if(strstr(buffer, "SETT")){////////COME BACK HERE LATE
+ setT();
+ }
+ else if(strstr(buffer, "STATEON")){
+ stateon();
+ }
+ else if(strstr(buffer, "STATEOFF")){
+ stateoff();
+ }
+ else if(strstr(buffer, "LOGGINGON")){
+ loggingon();
+ }
+ else if(strstr(buffer, "LOGGINGOFF")){
+ loggingoff();
+ }
+ else if(strstr(buffer, "DELETEN")){///////COME BACK HERE LATE
+ deleten();
+ }
+ else
+ {
+ printf("UNRECOGNISED\n\r");
+ }
+ }
+ }
+
+
+void help(){
+ printf("HELP: \n\rFOR COMMAND LIST, type COMMANDLIST\n\r");
+ }
+void readalldata(){
+ printf("read all data\n\r");
+ } //displays date, tim, temperature, presure, ligt
+void deletealldata(){
+ printf("delete all data \n\r");
+ } //deletes all memory from th iternal memory
+void readn(){
+ printf("read all user defined records\n\r");
+ }//returns past <n> records
+void deleten()
+{
+ printf("Delete Oldest Record\n\r");
+ }//deletes the <n> records
+void setdate(){
+ printf("Set Date\n\r");
+ } //sets the day month and year
+void settime(){
+printf("Set Time\n\r");
+} //sets the clock hours, minutes, seconds
+void setT()
+{
+ printf("Set Sampling Period 'T'\n\r");
+ } //sets the sampling period to <T> seconds
+void stateon(){
+ printf("Set Sampling ON\n\r");
+ } //turns ampling ON and OFF
+void stateoff(){
+ printf("Set Sampling OFF\n\r");
+ }
+void loggingon(){
+
+ printf("Logging On\n\r");
+ }
+void loggingoff(){
+
+ printf("Logging Off\n\r");
+ }
+ //turns diagnostic logging ON and OFF
+int main(){
+
+ help();
+ while(true){
+ datain();
+ readdata();
+ }
+ }
+
\ No newline at end of file