Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); 00004 AnalogIn sensor(A2); 00005 00006 int main() { 00007 float temperature1; 00008 float temperature2; 00009 pc.printf("\n\r"); 00010 pc.printf("BD1020HFV Temperature sensor test program.\n\r"); 00011 pc.printf("All values are approximates based on specification graph.\n\r"); 00012 pc.printf("Formula values should be calibrated before use.\n\r"); 00013 while(1) { 00014 //Input voltage 0-3.3V == 0.0-1.0f 00015 //-40'C == 1.87V 00016 // 0'C == 1.546V 00017 //192'C == 0V (out of scale) 00018 //1.87V / 232'C = 0.008060V/'C 00019 00020 temperature1 = -(1000 * (sensor * 3.3f) - 1546) / 8.2; 00021 temperature2 = 192 - ( sensor * 3.3f / 0.008060 ); 00022 pc.printf("Temperature, formula1=%5.3f, formula2=%5.3f\r\n", temperature1, temperature2); 00023 wait(1); 00024 } 00025 }
Generated on Wed Jul 13 2022 06:34:20 by
1.7.2
Rohm BD1020HFV | Temperature Sensor