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 SDFileSystem
Diff: main.cpp
- Revision:
- 2:8e4ad4ac6425
- Parent:
- 0:6337f8cfdd73
- Child:
- 3:f281a7095433
--- a/main.cpp Tue Oct 08 11:41:16 2019 +0000
+++ b/main.cpp Fri Oct 25 08:54:07 2019 +0000
@@ -1,5 +1,5 @@
/*
-SDカードに文字列を書き込む.
+SDカードに整数を書き込む.
<pin接続>
NSS: pin25 --- pin2 CD/DAT3
SCK: pin26 --- pin5 CLK
@@ -9,24 +9,25 @@
#include "mbed.h"
#include "SDFileSystem.h"
-DigitalOut myled(PB_1);
-Serial pc(PA_9, PA_10, 115200); //pin 19, 20
+DigitalOut myled(PB_1); //pin15
+Serial pc(PA_9, PA_10, 9600); //pin19,20 TX,RX
-SDFileSystem sd = SDFileSystem(PB_5, PB_4, PB_3, PA_15, "sd"); //pin 28, 27, 26, 25
+SDFileSystem sd = SDFileSystem(PB_5, PB_4, PB_3, PA_15, "sd"); //pin28,27,26,25
int main(){
wait(1.0); //気持ち
pc.printf("Start.\n\r");
- myled = 1;
FILE *fp = fopen("/sd/test.csv", "w");
//FILE *fp = fopen("/sd/test.txt", "w");
if(fp != NULL){
+ myled = 1;
pc.printf("Writing to SDcard......\n\r");
for(int i=1;i<10;i++){
fprintf(fp, "%d\n", i);
}
fclose(fp);
+ myled = 0;
}
else{
pc.printf("Failed.\n\r");