fuck this

Dependencies:   BMP280

Committer:
mwthewsey
Date:
Tue Jan 09 10:25:17 2018 +0000
Revision:
13:41c394fa932c
Parent:
12:03589f1d5c30
Child:
19:40c721f01ed2
Serial,LCD,Sampling,SD,Web Working.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:65ff7ad381e8 1 #include "mbed.h"
Swaggie 2:5a38ae8459d5 2 #include "WebUI.h"
Swaggie 2:5a38ae8459d5 3 #include "Serial.h"
Swaggie 3:8fa1e77c8a5d 4 #include "Sampling.h"
Swaggie 3:8fa1e77c8a5d 5 #include "LCD.h"
mwthewsey 11:b538e73841ae 6 #include "SDCard.h"
Swaggie 5:bea93c8e50b7 7 #include "SDBlockDevice.h"
mwthewsey 12:03589f1d5c30 8
Swaggie 5:bea93c8e50b7 9
Swaggie 6:8e1795a5886b 10
mwthewsey 12:03589f1d5c30 11 //Hardware setup
mwthewsey 12:03589f1d5c30 12 BMP280 sensor(D14, D15);
mwthewsey 12:03589f1d5c30 13 AnalogIn LDRSensor(A0);
mwthewsey 12:03589f1d5c30 14 DigitalOut SamplingLED(PB_10);
mwthewsey 12:03589f1d5c30 15
mwthewsey 12:03589f1d5c30 16 Serial PC(USBTX, USBRX);
Swaggie 5:bea93c8e50b7 17 //SD Card Object
mwthewsey 12:03589f1d5c30 18
mwthewsey 11:b538e73841ae 19 //LCD Object
mwthewsey 11:b538e73841ae 20 ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14);
Swaggie 5:bea93c8e50b7 21 //File pointer for the SD card
mwthewsey 12:03589f1d5c30 22 //FILE* fp;
noutram 0:65ff7ad381e8 23
noutram 0:65ff7ad381e8 24 int main()
noutram 0:65ff7ad381e8 25 {
Swaggie 2:5a38ae8459d5 26 //Initialise devices
mwthewsey 9:ac5673cca703 27 ////WebUISetup();
mwthewsey 12:03589f1d5c30 28
Swaggie 2:5a38ae8459d5 29 //Hardware Self Test
Swaggie 2:5a38ae8459d5 30
Swaggie 7:bf9f92ff02e8 31 //Initialise interrupts and times
mwthewsey 10:261f2b69c4c7 32 SerialStart();
mwthewsey 11:b538e73841ae 33 lcd.Start();
mwthewsey 12:03589f1d5c30 34 SDCardInit();
mwthewsey 13:41c394fa932c 35 WebUISetup();
mwthewsey 12:03589f1d5c30 36
mwthewsey 12:03589f1d5c30 37
Swaggie 6:8e1795a5886b 38 ConfigThreadsAndIR();
Swaggie 7:bf9f92ff02e8 39 firstSample = true; //Set only at start of program
Swaggie 6:8e1795a5886b 40
Swaggie 6:8e1795a5886b 41 //Run
Swaggie 7:bf9f92ff02e8 42 while (true)
Swaggie 6:8e1795a5886b 43 {
Swaggie 6:8e1795a5886b 44 if (NewEnvSample && NewLDRSample)
Swaggie 6:8e1795a5886b 45 {
Swaggie 7:bf9f92ff02e8 46 //New samples have been captured and are in the register
Swaggie 7:bf9f92ff02e8 47 IncrementIndex();
Swaggie 6:8e1795a5886b 48 //LCD Update Function
Swaggie 6:8e1795a5886b 49 NewEnvSample = false;
Swaggie 6:8e1795a5886b 50 NewLDRSample = false;
mwthewsey 11:b538e73841ae 51 lcd.UpdateData(tempReadings[currentIndex],presReadings[currentIndex],LDRReadings[currentIndex],timeReadings[currentIndex]);
mwthewsey 9:ac5673cca703 52
Swaggie 6:8e1795a5886b 53 }
mwthewsey 9:ac5673cca703 54
Swaggie 6:8e1795a5886b 55 }
Swaggie 7:bf9f92ff02e8 56 }