Lab3-01_save_read_the_number_lite

Dependencies:   mbed HEPTA_CDH_lite

Committer:
heptasat2021
Date:
Wed Aug 11 03:50:32 2021 +0000
Revision:
1:ddac5ec89167
Parent:
0:da0f6aca15b8
Child:
2:35a16011d7ce
Lab3-01_save_the_letters_lite

Who changed what in which revision?

UserRevisionLine numberNew contents of line
heptasat2021 0:da0f6aca15b8 1 #include "mbed.h"
heptasat2021 1:ddac5ec89167 2 #include "HEPTA_CDH.h"
heptasat2021 1:ddac5ec89167 3 HEPTA_CDH cdh(PB_5, PB_4, PB_3, PA_8, "sd");
heptasat2021 0:da0f6aca15b8 4 Serial pc(USBTX,USBRX,9600);
heptasat2021 0:da0f6aca15b8 5 int main()
heptasat2021 0:da0f6aca15b8 6 {
heptasat2021 1:ddac5ec89167 7 pc.printf("Hello World!\n");
heptasat2021 1:ddac5ec89167 8
heptasat2021 1:ddac5ec89167 9 mkdir("/sd/mydir", 0777);
heptasat2021 1:ddac5ec89167 10
heptasat2021 1:ddac5ec89167 11 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
heptasat2021 1:ddac5ec89167 12 if(fp == NULL) {
heptasat2021 1:ddac5ec89167 13 error("Could not open file for write\r\n");
heptasat2021 0:da0f6aca15b8 14 }
heptasat2021 1:ddac5ec89167 15 fprintf(fp, "Hello my name is HEPTA\r\n");
heptasat2021 1:ddac5ec89167 16 fclose(fp);
heptasat2021 1:ddac5ec89167 17
heptasat2021 1:ddac5ec89167 18 pc.printf("Goodbye World!\r\n");
heptasat2021 0:da0f6aca15b8 19 }