saving temperature in SD card

Dependencies:   LM75B SDFileSystem mbed

Fork of SDFileSystem_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
meriemz
Date:
Sun Apr 01 20:10:04 2018 +0000
Parent:
1:e4d7342be507
Commit message:
Saving tempirature via SD Card

Changed in this revision

LM75B.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LM75B.lib	Sun Apr 01 20:10:04 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/chris/code/LM75B/#6a70c9303bbe
--- a/main.cpp	Tue May 16 05:18:55 2017 +0000
+++ b/main.cpp	Sun Apr 01 20:10:04 2018 +0000
@@ -1,19 +1,36 @@
 #include "mbed.h"
+#include "LM75B.h"
 #include "SDFileSystem.h"
- 
+
+LM75B tmp(p28,p27);
+DigitalOut indicateur(LED1);
+Serial pc(USBTX, USBRX);
+
 SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
- 
-int main() {
-    printf("Hello World!\n");   
- 
+
+int main()
+{
+    indicateur = 1;
+    pc.printf("Hello World!\n");
+
     mkdir("/sd/mydir", 0777);
-    
+
     FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
     if(fp == NULL) {
         error("Could not open file for write\n");
     }
-    fprintf(fp, "Hello fun SD Card World!");
-    fclose(fp); 
- 
+    for (int i = 0; i<10; i++) {
+        fprintf(fp, "La temperature est = %.2f C",tmp.read());
+        wait(0.1);
+    }
+    fprintf(fp, "FIN");
+    fclose(fp);
+
     printf("Goodbye World!\n");
+    while (1) {
+        indicateur =0;
+        wait(0.50);
+        indicateur =1;
+        wait(0.50);
+    }
 }