sd kart yazma_ve_okuma

Dependencies:   mbed sd_kart_yazma_okma

Files at this revision

API Documentation at this revision

Comitter:
marvas
Date:
Wed Oct 16 08:48:13 2019 +0000
Commit message:
Sd kart yazma ve okuma

Changed in this revision

SDFileSystem.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Wed Oct 16 08:48:13 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Marvas/code/sd_kart_yazma_okma/#46785cd800a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 16 08:48:13 2019 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd"); // mosi, miso, sclk, cs(scl)
+unsigned char c;
+
+int main()
+{
+    mkdir("/sd", 0777);
+//mkdir klasör oluşturur.
+//0777 dosyaya veri yazıp okumayı etkinleştirir.
+    while(1) {
+        FILE *fp = fopen("/sd/ornek.txt", "a");
+        /* a - dosyanın içerisine var olan verinin yanına ekleme yapar
+        r - Dosyadan okuma yapar
+        w - Dosyadan verileri siler yeni veriyi ekler.
+        */
+        if(fp == NULL) {
+            error("Yazma icin dosya acilamadi \n");
+            printf("Yazma icin dosya acilamadi \n");
+        }
+
+        else {
+            //Sd karta yazar
+            fprintf(fp, "mehmet akif arvas");
+            fclose(fp); //Dosya kapat
+//
+            FILE *fpr = fopen("/sd/sicaklik.txt", "r");
+            //Okunacak dosya seçildi
+
+//file end of. Okuma işlemi bitene kadar devam et.
+//Dosya sonuna kadar okumaya devam et.
+            while (!feof(fpr)) {
+                c=fgetc(fpr);
+                printf("%c",c);
+            }
+            fclose(fpr);
+        }
+    }
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 16 08:48:13 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file