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 H3LIS331DL
Diff: main.cpp
- Revision:
- 6:bf4321ef0330
- Parent:
- 5:fbeb85ebd47b
--- a/main.cpp Tue Aug 03 08:35:52 2021 +0000 +++ b/main.cpp Wed Aug 04 06:41:02 2021 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" - +#include "SDFileSystem.h" /* This basic example just shows how to read the ADC internal channels raw values. Please look in the corresponding device reference manual for a complete @@ -36,10 +36,14 @@ LowPowerTicker interrput; SPI STSPI(PB_15, PB_14, PB_13); //mosi,miso,clk DigitalOut STSPICS(PB_12); + +SDFileSystem *sd = new SDFileSystem(PA_12, PA_11, PB_3, PA_15, "sd"); // mosi, miso, sclk, cs, name + DigitalOut led(PB_5); int initLIS3DH(); int read3axes(short *tx,short *ty,short *tz); int readTemp(short *tmp); +FILE *fp; int main() { @@ -77,10 +81,25 @@ initLIS3DH(); - h3dacc.init(H3LIS331DL_ODR_100Hz, H3LIS331DL_NORMAL,H3LIS331DL_FULLSCALE_2); + h3dacc.init(H3LIS331DL_ODR_100Hz, H3LIS331DL_NORMAL,H3LIS331DL_FULLSCALE_2);//これで初期化している pc.printf("\nSTM32 ADC internal channels reading example\r\n"); pc.printf("\nSTM32 3D acc sensor example\r\n"); + + fp = fopen("/sd/testlog.txt", "a"); + + if (fp == NULL) + { + pc.printf("open error!!\r\n"); + + } + else + { + pc.printf("SD opened\r\n"); + fclose(fp); + wait_ms(10); + } + while(1) { // pc.printf("ADC Temp = %f\r\n", (adc_temp.read()*100)); // pc.printf("ADC VRef = %f\r\n", adc_vref.read());