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.
main.cpp
00001 #include "mbed.h" 00002 #include "MCP9803.h" 00003 00004 ////F446RE Board 00005 //MCP9803 TempSensor(PB_9,PB_8,0x90,100000); 00006 00007 //F042K6 Board 00008 MCP9803 TempSensor(PB_7,PB_6,0x90,100000); 00009 00010 int main() 00011 { 00012 // Example of how to Configure Sensor 00013 00014 int configSuccess = TempSensor.ConfigSensor(0x00,0x01,0x00,0x02,0x03,0x00); 00015 00016 // Print value returned from ConfigSensor 00017 // 0 indicates success, 1 indicates failure 00018 printf("CONFIG Success = %d\r\n\r\n",configSuccess); 00019 00020 // Print raw temp value 00021 // Anything other than 0x0FF0 indicates success 00022 printf("Temp Raw = %04x\r\n",TempSensor.RawTempValue()); 00023 00024 // Print converted temp values 00025 // Anything other than -2000.000 indicates success 00026 printf("Temp C = %f\r\n",TempSensor.FormattedTempValue(CELCIUS)); 00027 printf("Temp F = %f\r\n",TempSensor.FormattedTempValue(FARENHEIT)); 00028 printf("Temp K = %f\r\n",TempSensor.FormattedTempValue(KELVIN)); 00029 00030 // Example of failure from sending wrong format 00031 printf("Temp ? = %f\r\n",TempSensor.FormattedTempValue(0x0F)); 00032 }
Generated on Sun Jul 24 2022 05:14:36 by
1.7.2