my code as off 16/12/2018
Dependencies: mbed BMP280 ELEC350-Practicals-FZ429_2
main.cpp
- Committer:
- ChrisHayes
- Date:
- 2018-11-16
- Revision:
- 0:d01bf1d73c6e
- Child:
- 1:e274a5cc021d
File content as of revision 0:d01bf1d73c6e:
#include "mbed.h" #include "TextLCD.h" #include "sample_hardware.hpp" #include "mbed_events.h" TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4 DigitalOut myled(LED1); AnalogIn LDRin(PA0); EventQueue queue; void takeSample() { float temp = sensor.getTemperature(); float pressure = sensor.getPressure(); float light = LDR_in lcd.cls(); //Display on LCD screen lcd.printf("T= %5.1f", temp); lcd.printf(" L= %5.1f", light); lcd.printf("P= %5.1f\n", pressure); } int main() { post(); lcd.printf("Hello World!\n"); lcd.printf("Suck my enormous\n"); wait(1); lcd.cls(); wait(1); while(1) { //Set up tasks on the main thread queue.call_every(5000, takeSample); //Main queue event loop queue.dispatch(); } }