Nucleo F303K8とMS5607を用いた気圧検出における処理時間の計測

Dependencies:   MS5607 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 //#include "MS5607SPI.h"
00004 #include "MS5607I2C.h"
00005 
00006 //MS5607SPI ms5607(p11, p12, p13, p3);
00007 MS5607I2C ms5607(PB_7, PB_6, false);
00008 DigitalOut myled(LED1);
00009 Serial pc(USBTX, USBRX);
00010 Timer timer;
00011 
00012 int main()
00013 {
00014     float Alt;
00015     int miri=1000;
00016 
00017     while(1) {
00018         wait(1);
00019 
00020         myled = 1;
00021         wait(0.2);
00022         myled = 0;
00023         wait(0.2);
00024 
00025         timer.reset();
00026         timer.start();
00027         Alt=ms5607.getAltitude();
00028         timer.stop();
00029         float t=timer.read();
00030         float time=t*miri;
00031         pc.printf("time= %f ms\n",time);
00032     }
00033 }