witの生データをとりあえずbinに書き込むだけのプログラム
Dependencies: mbed SDFileSystem
Diff: main.cpp
- Revision:
- 0:d7ab22d75bce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jul 24 07:33:28 2021 +0000 @@ -0,0 +1,31 @@ +/* mbed Microcontroller Library + * Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include "SDFileSystem.h" +//#include "platform/mbed_thread.h" + +Serial jy901(D1,D0); +Serial pc(USBTX,USBRX); +SDFileSystem sd(PA_7, PA_6, PA_5, PA_4, "sd"); // the pinout on the mbed Cool Components workshop board + +// Blinking rate in milliseconds +int main() +{ + jy901.baud(9600); + printf("Hello World!\n"); + + mkdir("/sd/mydir2", 0777); + FILE *fp = fopen("/sd/mydir2/sdtest.bin", "w"); + + if(fp == NULL) { + error("Could not open file for write\n"); + } + + while(1){ + fputc(jy901.getc(),fp); + } + fclose(fp); +}