sensor
Dependencies: BMP280 ELEC350-Practicals-FZ429 BME280
main.cpp
- Committer:
- Joelpallent
- Date:
- 2018-11-30
- Revision:
- 6:2423aac599cd
- Parent:
- 5:e24f1e549da1
File content as of revision 6:2423aac599cd:
/* Access an SD Card using SPI */ #include "mbed.h" //#include "SDBlockDevice.h" #include "FATFileSystem.h" #include "sample_hardware.hpp" #include "mbed_events.h" #define _DEBUG #include "BMP280.h" #define _DEBUG //SD Card Object //SDBlockDevice sd(D11, D12, D13, D10); // mosi, miso, sclk, cs //Event queue for main EventQueue queue; //File pointer for the SD card FILE* fp; //Flag to indicate if the user has ejected the SD card //bool ejected = false; //This is called every 5 seconds by the main event queue (main thread) void takeSample() { //If the card is unmounted, just return // if (ejected == true) { // return; // } //Read Sensors (I2C) float temp = sensor.getTemperature(); float pressure = sensor.getPressure(); //Write to SD Card // fprintf(fp, "%f,%f\n", temp, pressure); //Flash to indicate the sampling is alive redLED = 1; Thread::wait(100); redLED = 0; } int main() { //POWER ON SELF TEST post(); // printf("Initialise\n\r\r"); while(1) { Thread::wait(5000); post(); } }