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.
Dependencies: mbed sd_kart_yazma_okma
main.cpp
- Committer:
- marvas
- Date:
- 2019-10-16
- Revision:
- 0:ea4c45f3cff7
- Child:
- 1:2baac9785cda
File content as of revision 0:ea4c45f3cff7:
#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);
        }
    }
    }