![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
my code as off 16/12/2018
Dependencies: mbed BMP280 ELEC350-Practicals-FZ429_2
main.cpp
- Committer:
- ChrisHayes
- Date:
- 2018-12-16
- Revision:
- 1:e274a5cc021d
- Parent:
- 0:d01bf1d73c6e
File content as of revision 1:e274a5cc021d:
#include "mbed.h" #include "TextLCD.h" #include "sample_hardware.hpp" #include "sample_buffer.hpp" //#include "mbed_events.h" #include "take_a_sample_queue.hpp" #include "set_time_on_startup.hpp" //#include "stdio.h" Ticker timing; TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4 DigitalOut myled(LED1); //AnalogIn LDRin(PA0); EventQueue queue; EventQueue remove_sample; //-------------------------------------------------------------------------------- Thread t1; //sample event queue Thread t2; //counting up time Thread t3; //website Thread t4; //serial void take_sample (void) { queue.call_every(1, takeSampleFun); queue.dispatch(); } void display_sample_lcd (void) { while(1) { greenLED = !greenLED; float pressure = takeDataFromBuffer(2); float light = takeDataFromBuffer(1); float temp = takeDataFromBuffer(0); lcd.printf("T=%5.1f", temp); lcd.printf("L=%5.1f\n", light); lcd.printf(" P=%1.5f\n", pressure); Thread::wait(2000); } } void test3 (void) { while(1) { redLED = !redLED; Thread::wait(1000); } } void test4 (void) { while(1) { //yellowLED = !yellowLED; Thread::wait(1000); } } int main() { post(); lcd.printf("Hello World!\n"); lcd.printf("Uhhhh\n"); wait(1); lcd.cls(); // timing.attach(&takeSampleFun, 2.0); button_time(); t1.start(take_sample); t2.start(display_sample_lcd); t3.start(test3); t4.start(test4); }