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 "MSS.h" 00003 #include "HDC1000.h" 00004 00005 #define HDC1000_I2C_ADDRESS 0x40 00006 00007 HDC1000 *hdc1000 = 0 ; 00008 00009 int main() { 00010 float temp, hume ; 00011 uint16_t dev_id, man_id ; 00012 int mode = 0 ; 00013 00014 hdc1000 = new HDC1000(PIN_SDA, PIN_SCL, PIN_INT0, HDC1000_I2C_ADDRESS) ; 00015 hdc1000->reset() ; 00016 wait(1) ; 00017 00018 printf("=== test HDC1000 for %s (%s) ===\n", BOARD_NAME, __DATE__) ; 00019 dev_id = hdc1000->getDeviceID() ; 00020 printf("Device ID = 0x%04X\n", dev_id) ; 00021 man_id = hdc1000->getManufactureID() ; 00022 printf("Manufacture ID = 0x%04X\n", man_id) ; 00023 00024 while(1) { 00025 printf("mode = %d ", mode) ; 00026 hdc1000->setMode(mode) ; 00027 wait(1) ; 00028 if (mode == 1) { 00029 hdc1000->readData(&temp, &hume) ; 00030 } else { 00031 temp = hdc1000->readTemperature() ; 00032 hume = hdc1000->readHumidity() ; 00033 } 00034 printf("Temperature: %.2f C Humidity: %.2f %%\n",temp, hume) ; 00035 wait(1) ; 00036 mode = (mode == 0) ? 1 : 0 ; 00037 } 00038 }
Generated on Mon Jul 18 2022 16:40:09 by
1.7.2