![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
my code as off 16/12/2018
Dependencies: mbed BMP280 ELEC350-Practicals-FZ429_2
take_a_sample_queue.cpp@1:e274a5cc021d, 2018-12-16 (annotated)
- Committer:
- ChrisHayes
- Date:
- Sun Dec 16 15:25:04 2018 +0000
- Revision:
- 1:e274a5cc021d
this is my code up two 16/12/2018
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ChrisHayes | 1:e274a5cc021d | 1 | //#include "mbed.h" |
ChrisHayes | 1:e274a5cc021d | 2 | //#include "TextLCD.h" |
ChrisHayes | 1:e274a5cc021d | 3 | #include "sample_hardware.hpp" |
ChrisHayes | 1:e274a5cc021d | 4 | #include "sample_buffer.hpp" |
ChrisHayes | 1:e274a5cc021d | 5 | |
ChrisHayes | 1:e274a5cc021d | 6 | void takeSampleFun() |
ChrisHayes | 1:e274a5cc021d | 7 | { |
ChrisHayes | 1:e274a5cc021d | 8 | yellowLED = !yellowLED; |
ChrisHayes | 1:e274a5cc021d | 9 | // TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4 |
ChrisHayes | 1:e274a5cc021d | 10 | float temp = sensor.getTemperature(); |
ChrisHayes | 1:e274a5cc021d | 11 | float pressure = sensor.getPressure(); |
ChrisHayes | 1:e274a5cc021d | 12 | float light = adcIn; |
ChrisHayes | 1:e274a5cc021d | 13 | float data=0; |
ChrisHayes | 1:e274a5cc021d | 14 | int row =0; |
ChrisHayes | 1:e274a5cc021d | 15 | |
ChrisHayes | 1:e274a5cc021d | 16 | |
ChrisHayes | 1:e274a5cc021d | 17 | // lcd.cls(); |
ChrisHayes | 1:e274a5cc021d | 18 | |
ChrisHayes | 1:e274a5cc021d | 19 | //Display on LCD screen |
ChrisHayes | 1:e274a5cc021d | 20 | // lcd.printf("T=%5.1f", temp); |
ChrisHayes | 1:e274a5cc021d | 21 | // lcd.printf("L=%5.1f\n", light); |
ChrisHayes | 1:e274a5cc021d | 22 | // lcd.printf(" P=%1.5f\n", pressure); |
ChrisHayes | 1:e274a5cc021d | 23 | |
ChrisHayes | 1:e274a5cc021d | 24 | |
ChrisHayes | 1:e274a5cc021d | 25 | //adding temp to the buffer |
ChrisHayes | 1:e274a5cc021d | 26 | data = temp; |
ChrisHayes | 1:e274a5cc021d | 27 | row = 0; |
ChrisHayes | 1:e274a5cc021d | 28 | addDataToBuffer(data, row); |
ChrisHayes | 1:e274a5cc021d | 29 | |
ChrisHayes | 1:e274a5cc021d | 30 | |
ChrisHayes | 1:e274a5cc021d | 31 | //adding light to the buffer |
ChrisHayes | 1:e274a5cc021d | 32 | data = light; |
ChrisHayes | 1:e274a5cc021d | 33 | row = 1; |
ChrisHayes | 1:e274a5cc021d | 34 | addDataToBuffer(data,row); |
ChrisHayes | 1:e274a5cc021d | 35 | |
ChrisHayes | 1:e274a5cc021d | 36 | //adding pressure to the buffer |
ChrisHayes | 1:e274a5cc021d | 37 | data = pressure; |
ChrisHayes | 1:e274a5cc021d | 38 | row = 2; |
ChrisHayes | 1:e274a5cc021d | 39 | addDataToBuffer(data,row); |
ChrisHayes | 1:e274a5cc021d | 40 | |
ChrisHayes | 1:e274a5cc021d | 41 | //this is where the samples are taken from the buffer |
ChrisHayes | 1:e274a5cc021d | 42 | |
ChrisHayes | 1:e274a5cc021d | 43 | // takeDataFromBuffer(2); |
ChrisHayes | 1:e274a5cc021d | 44 | // takeDataFromBuffer(1); |
ChrisHayes | 1:e274a5cc021d | 45 | // takeDataFromBuffer(0); |
ChrisHayes | 1:e274a5cc021d | 46 | // takeDataFromBuffer(3); |
ChrisHayes | 1:e274a5cc021d | 47 | } |