BD1020HFV Temperature sensor test code

Dependencies:   mbed

main.cpp

Committer:
MikkoZ
Date:
2016-09-08
Revision:
1:ba7e525074f9
Parent:
0:ee7b9cc966d7
Child:
2:913fc12a42a7

File content as of revision 1:ba7e525074f9:

#include "mbed.h"

Serial pc(USBTX, USBRX);
AnalogIn sensor(A2);

int main() {
    float temparature;
    pc.printf("\nBD1020HFV Temperature sensor test program.\n");
    while(1) {
        temparature = -(1000 * (sensor * 3.3f) - 1546) / 8.2;
        pc.printf("Temperature=%5.3f\r\n", temparature);
        wait(0.4);
    }
}