test program for MPL3115A2

Dependencies:   C12832 LM75B MPL3115A2 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "LM75B.h"
00003 #include "MSS.h"
00004 #include "MPL3115A2.h"
00005 #define MPL3115A2_I2C_ADDRESS (0x60)
00006 
00007 Serial pc(USBTX,USBRX);
00008 
00009 //#include "C12832.h"
00010 //C12832 lcd(p5, p7, p6, p8, p11);
00011 //LM75B sensor(p9,p10);
00012 MPL3115A2 mpl(PIN_SDA, PIN_SCL, MPL3115A2_I2C_ADDRESS) ;
00013 
00014 int main() {
00015     double alt, bar, temp ;
00016     unsigned char xy;
00017     printf("Bonjour\r\n");
00018     
00019     mpl.setBarIn((unsigned short)(101300/2));
00020     mpl.activate();
00021     xy=mpl.getID();
00022     printf("mouche = %x\r\n",xy);
00023  //   sensor.open();
00024     
00025     while(1) {
00026         alt = mpl.getAltitude() ;
00027         bar = mpl.getPressure() ;
00028         temp = mpl.getTemperature() ;
00029  /*       lcd.cls();
00030         lcd.locate(0,1);
00031         lcd.printf("ALTI,    BAR,  TEMP") ;
00032         lcd.locate(0,10);*/
00033         printf("%5.2f, %5.2f, %5.2f\r\n",alt, bar, temp) ;
00034         wait(1) ;
00035     }
00036 }