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

Dependencies:   MS5607 mbed

main.cpp

Committer:
RyotaNakamura
Date:
2017-02-07
Revision:
0:c8ca6be83e2e

File content as of revision 0:c8ca6be83e2e:

#include "mbed.h"

//#include "MS5607SPI.h"
#include "MS5607I2C.h"

//MS5607SPI ms5607(p11, p12, p13, p3);
MS5607I2C ms5607(PB_7, PB_6, false);
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
Timer timer;

int main()
{
    float Tem;
    int miri=1000;

    while(1) {
        wait(1);

        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);

        timer.reset();
        timer.start();
        Tem=ms5607.getTemperature();
        timer.stop();
        float t=timer.read();
        float time=t*miri;
        pc.printf("time= %f ms\n",time);
    }
}