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.
HIH4030/HIH4030.cpp@0:feaa05d35ccf, 2012-03-07 (annotated)
- Committer:
- AlexAllen
- Date:
- Wed Mar 07 20:02:35 2012 +0000
- Revision:
- 0:feaa05d35ccf
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| AlexAllen | 0:feaa05d35ccf | 1 | #include "HIH4030.h" |
| AlexAllen | 0:feaa05d35ccf | 2 | #include "mbed.h" |
| AlexAllen | 0:feaa05d35ccf | 3 | |
| AlexAllen | 0:feaa05d35ccf | 4 | float HIH4030::getH(float temp) |
| AlexAllen | 0:feaa05d35ccf | 5 | { |
| AlexAllen | 0:feaa05d35ccf | 6 | float sensHum, trueHum; |
| AlexAllen | 0:feaa05d35ccf | 7 | float vout = 3.3 * 2.0 * read(); |
| AlexAllen | 0:feaa05d35ccf | 8 | float vsupply = 5.0; |
| AlexAllen | 0:feaa05d35ccf | 9 | |
| AlexAllen | 0:feaa05d35ccf | 10 | sensHum = ( ( vout / vsupply ) + 0.16 ) / 0.0062; |
| AlexAllen | 0:feaa05d35ccf | 11 | trueHum = ( 1.0546 - 0.00216 * temp ) * sensHum; |
| AlexAllen | 0:feaa05d35ccf | 12 | |
| AlexAllen | 0:feaa05d35ccf | 13 | return trueHum; |
| AlexAllen | 0:feaa05d35ccf | 14 | } |