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.
Fork of HTU21D by
Revision 3:caccf1879f14, committed 2016-10-17
- Comitter:
- GregC
- Date:
- Mon Oct 17 03:03:07 2016 +0000
- Parent:
- 2:4fd07be6bad8
- Commit message:
- Simple temperature and humidity program example for Hexiwear featuring UART
Changed in this revision
HTU21D/HTU21D.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4fd07be6bad8 -r caccf1879f14 HTU21D/HTU21D.cpp --- a/HTU21D/HTU21D.cpp Sun Oct 19 19:27:19 2014 +0000 +++ b/HTU21D/HTU21D.cpp Mon Oct 17 03:03:07 2016 +0000 @@ -1,31 +1,23 @@ -/** - * @author Alex Lipford - * Georgia Institute of Technology - * ECE 4180 Embeded Systems Design - * Professor Hamblen - * 10/19/2014 - * - * @section LICENSE - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <alexlipford@gmail.com> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. - * ---------------------------------------------------------------------------- - * - * - * @section DESCRIPTION - * - * HTU21D Humidity and Temperature sensor. - * - * Datasheet, specs, and information: - * - * https://www.sparkfun.com/products/12064 - */ +// @author Alex Lipford +// Georgia Institute of Technology +// ECE 4180 Embeded Systems Design +// Professor Hamblen +// 10/19/2014 + +// @section LICENSE +// ---------------------------------------------------------------------------- +// "THE BEER-WARE LICENSE" (Revision 42): +// <alexlipford@gmail.com> wrote this file. As long as you retain this notice you +// can do whatever you want with this stuff. If we meet some day, and you think +// this stuff is worth it, you can buy me a beer in return. +// ---------------------------------------------------------------------------- -/** - * Includes - */ +// @section DESCRIPTION +// HTU21D Humidity and Temperature sensor. +// Datasheet, specs, and information: +// https://www.sparkfun.com/products/12064 + + #include "HTU21D.h" HTU21D::HTU21D(PinName sda, PinName scl) { @@ -33,9 +25,6 @@ i2c_ = new I2C(sda, scl); //400KHz, as specified by the datasheet. i2c_->frequency(400000); - - - } int HTU21D::sample_ctemp(void) { @@ -59,7 +48,6 @@ float realTemperature = -46.85 + (175.72 * tempTemperature); //From page 14 return (int)realTemperature; - } int HTU21D::sample_ftemp(void){ @@ -74,8 +62,6 @@ int ktemp = temptemp + 274; return ktemp; - - } int HTU21D::sample_humid(void) { @@ -101,8 +87,6 @@ float tempRH = rawHumidity / (float)65536; //2^16 = 65536 float rh = -6 + (125 * tempRH); //From page 14 - return (int)rh; - }