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.
main.cpp
- Committer:
- HeptaSatTraining2019
- Date:
- 2019-08-27
- Revision:
- 26:f15b873a018c
- Parent:
- 25:5fd40a170032
- Child:
- 27:210fe762fa94
File content as of revision 26:f15b873a018c:
#include "mbed.h"
#include "HEPTA_CDH.h"
Serial pc(USBTX,USBRX);
HEPTA_CDH cdh(p5, p6, p7, p8, "sd");
int main()
{
pc.baud(9600);
pc.printf("Hello world!\r\n");
char str[100];
mkdir("/sd/mydir", 0777);
FILE *fp = fopen("/sd/mydir/test.txt","w");
if(fp == NULL) {
error("Could not open file for write\r\n");
}
for(int i=0; i<10; i++)fprintf(fp,"Hello my name is HEPTA!\r\n");
fclose(fp);
fp = fopen("/sd/mydir/test.txt","r");
for(int j = 0; j < 10; j++) {
fgets(str,100,fp);
puts(str);
}
fclose(fp);
pc.printf("Goodbye!!\r\n");
}