Lab 3 Mark Roche

Committer:
mark_roche
Date:
Wed May 11 17:25:34 2022 +0000
Revision:
3:41c5f0a3b25d
Parent:
2:0f36a8081ee1
Lab 3 Mark Roche

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mark_roche 3:41c5f0a3b25d 1 //____Industry 4.0: Cyber Phys Systs-51296_______
mark_roche 3:41c5f0a3b25d 2 //____Lab 3 Mark Roche_____
mark_roche 3:41c5f0a3b25d 3
mark_roche 3:41c5f0a3b25d 4 /*
liamc 2:0f36a8081ee1 5 #include "mbed.h"
liamc 2:0f36a8081ee1 6
liamc 2:0f36a8081ee1 7 LocalFileSystem local("local"); // Create the local filesystem under the name "local"
liamc 2:0f36a8081ee1 8
liamc 2:0f36a8081ee1 9 int main() {
liamc 2:0f36a8081ee1 10 FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing
liamc 2:0f36a8081ee1 11 fprintf(fp, "Hello World!");
liamc 2:0f36a8081ee1 12 fclose(fp);
mark_roche 3:41c5f0a3b25d 13 }
mark_roche 3:41c5f0a3b25d 14
mark_roche 3:41c5f0a3b25d 15 */
mark_roche 3:41c5f0a3b25d 16
mark_roche 3:41c5f0a3b25d 17 #include ”mbed.h”
mark_roche 3:41c5f0a3b25d 18 #include “LM75B.h”
mark_roche 3:41c5f0a3b25d 19 #include “C12832.h”
mark_roche 3:41c5f0a3b25d 20
mark_roche 3:41c5f0a3b25d 21 //using std::string;
mark_roche 3:41c5f0a3b25d 22
mark_roche 3:41c5f0a3b25d 23 C12832 lcd(p5, p7, p6, p8, p11);
mark_roche 3:41c5f0a3b25d 24
mark_roche 3:41c5f0a3b25d 25 LM75B sensor(p28,p27);
mark_roche 3:41c5f0a3b25d 26 Serial pc(USBTX,USBRX);
mark_roche 3:41c5f0a3b25d 27 LocalFileSystem local(“local”); // Create the local filesystem under the name “local”
mark_roche 3:41c5f0a3b25d 28
mark_roche 3:41c5f0a3b25d 29 int count;
mark_roche 3:41c5f0a3b25d 30 float temperature;
mark_roche 3:41c5f0a3b25d 31
mark_roche 3:41c5f0a3b25d 32 void writeValue (float temperature){
mark_roche 3:41c5f0a3b25d 33 FILE *fp = fopen("/local/out.txt", “a+”); // Open “out.txt” on the local file system for writing
mark_roche 3:41c5f0a3b25d 34 //if (!fp) fp = fopen("/local/out.txt", “w”);
mark_roche 3:41c5f0a3b25d 35 fprintf(fp,"%f\r\n",temperature);
mark_roche 3:41c5f0a3b25d 36 //fputs(“f\r\n”,fp);
mark_roche 3:41c5f0a3b25d 37 fclose(fp);
mark_roche 3:41c5f0a3b25d 38 printf(“New Entry Added\r\n”);
mark_roche 3:41c5f0a3b25d 39 return;
mark_roche 3:41c5f0a3b25d 40 }
mark_roche 3:41c5f0a3b25d 41
mark_roche 3:41c5f0a3b25d 42 int main ()
mark_roche 3:41c5f0a3b25d 43 {
mark_roche 3:41c5f0a3b25d 44
mark_roche 3:41c5f0a3b25d 45
mark_roche 3:41c5f0a3b25d 46 while (1) {
mark_roche 3:41c5f0a3b25d 47 writeValue((float)sensor);
mark_roche 3:41c5f0a3b25d 48 displayValues((float)sensor);
mark_roche 3:41c5f0a3b25d 49 readFile();
mark_roche 3:41c5f0a3b25d 50 printf(“About to Wait 10 seconds\r\n”);
mark_roche 3:41c5f0a3b25d 51 wait(10.0);
mark_roche 3:41c5f0a3b25d 52 count++;
mark_roche 3:41c5f0a3b25d 53 }
mark_roche 3:41c5f0a3b25d 54
liamc 2:0f36a8081ee1 55 }