![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
(in progress)
Dependencies: LM75B EALib mbed
Diff: main_proj3.cpp
- Revision:
- 1:f5ad0c1f9d0f
- Parent:
- 0:53a593dea14e
- Child:
- 2:85472a77be8b
--- a/main_proj3.cpp Mon Oct 12 23:03:47 2015 +0000 +++ b/main_proj3.cpp Tue Oct 13 00:35:33 2015 +0000 @@ -1,23 +1,24 @@ -#include <LM75B.h> //Temperature header file -#include <MMA7455.h> // Accelerometer header file +#include "LM75B.h" //Temperature header file +#include "MMA7455.h" // Accelerometer header file +#include "mbed.h" Serial myUart (USBTX, USBRX); -LM75B tempsensor(P0_27, P0_28); +LM75B tempsensor(P0_27, P0_28, LM75B::ADDRESS_1); MMA7455 sensor(P0_27, P0_28); int main() { - char in_bound; + float temp_reading; + myUart.baud(19200); // setting the baud rate - int value[3] = { 0,0,0}; + while(1) { - if(!sensor.setMode(MMA7455::ModeMeasurement) - printf("Unable to set mode for MMA7455!\n"); - if(!sensor.calibrate()) - printf("Failed to calibrate MMA7455!\n"); - - if(!sensor.read) + temp_reading = (9/5)* tempsensor.temp() + 32; // converted to Fahrenheit + myUart.printf("Current board temperature (Fahrenheit): %f\r", temp_reading); + wait(0.5); + +