Comments added and commented out outdated code
Dependencies: Peripherals SD_Lib Time_Lib_v2 Year3_Version5 BMP280 LCDFunctions TextLCD BME280 Serial_Lib
main.cpp
- Committer:
- erolleyparnell
- Date:
- 2018-11-23
- Revision:
- 8:dde5976445b4
- Parent:
- 7:981670f59caf
- Child:
- 11:799025124e87
File content as of revision 8:dde5976445b4:
#include "mbed.h" #include "TextLCD.h" #include "SDBlockDevice.h" #include "FATFileSystem.h" #include "sample_hardware.hpp" #include "thread_functions.hpp" //Function declarations void displayOnLcd(); void updateRealTimeClock(char *buffer); void getLineFromSerial(char *keyBuffer, int bufferLength); void displayMessageOnConsole(); void SettingTimeWithButtons (); void FunctionSensor(); void FunctionTime(); void FunctionSerial(); TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7 SDBlockDevice sd(PB_5, D12, D13, D10); // mosi, miso, sclk, cs Serial pc(SERIAL_TX, SERIAL_RX); time_t currentTime; char lcdBuffer[32]; DigitalOut myled(LED1); Ticker ticker; DigitalIn SWUser(USER_BUTTON); Mutex date_mutex; int setting; int t; //InterruptIn SW1; Thread t1; Thread t2; Thread t3; //LDR sensor AnalogIn LDD_ADC_In(A1); float fLDR = 0.0; float volts = 0.0; //Main thread int main() { lcd.printf("Select Time Option\n\n"); post(); //Initialise the SD card if ( sd.init() != 0) { printf("Init failed \n"); errorCode(FATAL); } //Create a filing system for SD Card FATFileSystem fs("sd", &sd); //Open to WRITE FILE* fp = fopen("/sd/test.csv","a"); if (fp == NULL) { error("Could not open file for write\n"); errorCode(FATAL); } // run threads t1.start(FunctionSensor); t2.start(FunctionTime); t3.start(FunctionSerial); }