Time: 17:33 Date: 10/12/2017 Description: Task 1,7,8 Currently Functioning
Dependencies: BME280 BMP280 TextLCD
Working Repository
SAMPLE.cpp@50:3d61ca637399, 2018-01-09 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue Jan 09 12:19:12 2018 +0000
- Revision:
- 50:3d61ca637399
- Parent:
- 48:244d6d81bb52
Dynamic Dating Working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 47:6d128e500875 | 1 | #include "SAMPLE.hpp" |
thomasmorris | 47:6d128e500875 | 2 | |
thomasmorris | 47:6d128e500875 | 3 | |
thomasmorris | 47:6d128e500875 | 4 | void Sampling_ISR() |
thomasmorris | 47:6d128e500875 | 5 | { |
thomasmorris | 47:6d128e500875 | 6 | t1.signal_set(SamplingTime); |
thomasmorris | 47:6d128e500875 | 7 | } |
thomasmorris | 47:6d128e500875 | 8 | void Sample_Event()//Samples the hardware and prints the result to the LCD |
thomasmorris | 47:6d128e500875 | 9 | { |
thomasmorris | 47:6d128e500875 | 10 | while(1) |
thomasmorris | 47:6d128e500875 | 11 | { |
thomasmorris | 47:6d128e500875 | 12 | Thread::signal_wait(SamplingTime); //Set the time between samples |
thomasmorris | 48:244d6d81bb52 | 13 | if(Log_Value == 3){pc.printf("Sample Being Taken\n");} |
thomasmorris | 47:6d128e500875 | 14 | Data_Active.set_temperature(sensor.getTemperature()); //Read Temperature |
thomasmorris | 47:6d128e500875 | 15 | Data_Active.set_pressure(sensor.getPressure()); //Read Pressure |
thomasmorris | 47:6d128e500875 | 16 | Data_Active.set_light(adcIn.read()); //Read Light |
thomasmorris | 48:244d6d81bb52 | 17 | if(Log_Value == 3){pc.printf("Temp Taken: %1.1f Pressure Taken: %1.1f Light Taken: %1.1f\n",sensor.getTemperature(),sensor.getPressure(),adcIn.read());} |
thomasmorris | 47:6d128e500875 | 18 | Time_Lock_Main.lock(); |
thomasmorris | 47:6d128e500875 | 19 | time_t buffer_time = time(NULL); |
thomasmorris | 47:6d128e500875 | 20 | Time_Lock_Main.unlock(); |
thomasmorris | 47:6d128e500875 | 21 | |
thomasmorris | 47:6d128e500875 | 22 | Data_Active.set_time(buffer_time); |
thomasmorris | 47:6d128e500875 | 23 | |
thomasmorris | 47:6d128e500875 | 24 | Red_led.flash(0.02);//ahh he saved everyone of us |
thomasmorris | 47:6d128e500875 | 25 | Write_Pointer = Write_Data(Data_Active,Write_Pointer); |
thomasmorris | 47:6d128e500875 | 26 | t1.signal_set(NotSamplingTime); |
thomasmorris | 48:244d6d81bb52 | 27 | if(Log_Value == 3){pc.printf("New Sample avaliable\n");} |
thomasmorris | 47:6d128e500875 | 28 | t2.signal_set(SD_Data_Ready); |
thomasmorris | 47:6d128e500875 | 29 | } |
thomasmorris | 47:6d128e500875 | 30 | } |