fuck this
Dependencies: BMP280
Diff: main.cpp
- Revision:
- 21:6e733076f49c
- Parent:
- 20:25939e03b803
- Child:
- 24:7bf408dc491a
diff -r 25939e03b803 -r 6e733076f49c main.cpp --- a/main.cpp Tue Jan 09 11:53:11 2018 +0000 +++ b/main.cpp Tue Jan 09 20:51:19 2018 +0000 @@ -8,31 +8,36 @@ #include "Logging.h" //Hardware setup -BMP280 sensor(D14, D15); //enviromental sensor -AnalogIn LDRSensor(A0); //LDR sensor -DigitalOut SamplingLED(PB_10);//LED to indicate sampling +BMP280 sensor(D14, D15); //Enviromental sensor +AnalogIn LDRSensor(A0); //LDR sensor +DigitalOut SamplingLED(PB_10); //LED to indicate sampling + //SD Card devices InterruptIn SD_WP(PE_10); InterruptIn UserButton(USER_BUTTON); SDBlockDevice sd(PB_5, D12, D13, D10); DigitalOut GreenLED(PB_11); -Serial PC(USBTX, USBRX); //Serial interface -//SD Card Object -ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14); //LCD pins and two timeset buttons +//Serial interface +Serial PC(USBTX, USBRX); + +//LCD card object. LCD pins and two timeset buttons +ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14); int main() { //Initialise devices firstSample = true; //Set only at start of program - logging = true; + logging = false; + //Hardware Self Test + //Initialise interrupts and times - SerialStart(); //Start serial comms - lcd.Start(); //Start LCD functionality - SDCardInit(); //Start SDCard functionality - WebUISetup(); //Start Web Interface + SerialStart(); //Start serial comms + lcd.Start(); //Start LCD functionality + SDCardInit(); //Start SDCard functionality + WebUISetup(); //Start Web Interface ConfigThreadsAndIR(); //Start sampling @@ -40,15 +45,16 @@ while (true) { if (NewEnvSample && NewLDRSample) { //New samples have been captured and are in the register - IncrementIndex(); + IncrementIndex(); //Index for buffers NewEnvSample = false; //Reset sampling threads NewLDRSample = false; - //push latest samples to LCD. + //Push latest samples to LCD. lcd.UpdateData(tempReadings[currentIndex],presReadings[currentIndex],LDRReadings[currentIndex],timeReadings[currentIndex]); LogEvent(Log_IndexInc); //Log position } if (logging) { + //Grab from mailbox and print to serial string QueueData = CheckLoggingQueue(); //Get the data from queue char char_array[QueueData.length()+1]; //Char array for message strcpy(char_array, QueueData.c_str()); //String must be converted to char array for printf