Battery and SDcard Q
Dependencies: mbed PowerControl SDFileSystem
Fork of HeptaBattery_SDFilesystem_Q by
main.cpp@0:9eb94b338772, 2016-12-09 (annotated)
- Committer:
- tomoya123
- Date:
- Fri Dec 09 04:53:49 2016 +0000
- Revision:
- 0:9eb94b338772
- Child:
- 1:6d9166677466
Battery and SDcard Q
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tomoya123 | 0:9eb94b338772 | 1 | #include "mbed.h" |
tomoya123 | 0:9eb94b338772 | 2 | #include "SDFileSystem.h" |
tomoya123 | 0:9eb94b338772 | 3 | #include "HeptaBattery.h" |
tomoya123 | 0:9eb94b338772 | 4 | Serial pc(USBTX,USBRX); |
tomoya123 | 0:9eb94b338772 | 5 | //ピンアサイン読み込み、オブジェクトの生成 |
tomoya123 | 0:9eb94b338772 | 6 | |
tomoya123 | 0:9eb94b338772 | 7 | |
tomoya123 | 0:9eb94b338772 | 8 | int main() { |
tomoya123 | 0:9eb94b338772 | 9 | pc.baud(9600); |
tomoya123 | 0:9eb94b338772 | 10 | float bt; |
tomoya123 | 0:9eb94b338772 | 11 | pc.printf("Hello world!\r\n"); |
tomoya123 | 0:9eb94b338772 | 12 | mkdir("/sd/mydir", 0777); |
tomoya123 | 0:9eb94b338772 | 13 | printf("helloworld\r\n"); |
tomoya123 | 0:9eb94b338772 | 14 | FILE *fp = fopen("/sd/mydir/sdtest.txt","w"); |
tomoya123 | 0:9eb94b338772 | 15 | if(fp == NULL) { |
tomoya123 | 0:9eb94b338772 | 16 | error("Could not open file for write\r\n"); |
tomoya123 | 0:9eb94b338772 | 17 | } |
tomoya123 | 0:9eb94b338772 | 18 | for(int i=0;i<10;i++){ |
tomoya123 | 0:9eb94b338772 | 19 | //メンバー関数の使用 |
tomoya123 | 0:9eb94b338772 | 20 | |
tomoya123 | 0:9eb94b338772 | 21 | |
tomoya123 | 0:9eb94b338772 | 22 | |
tomoya123 | 0:9eb94b338772 | 23 | |
tomoya123 | 0:9eb94b338772 | 24 | |
tomoya123 | 0:9eb94b338772 | 25 | } |
tomoya123 | 0:9eb94b338772 | 26 | fclose(fp); |
tomoya123 | 0:9eb94b338772 | 27 | printf("Goodbye!!\r\n"); |
tomoya123 | 0:9eb94b338772 | 28 | } |