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: HP206C mbed HMC5883L DHT DS1820
main.cpp@49:b1ac7ebb715f, 2018-10-08 (annotated)
- Committer:
- MathieuM
- Date:
- Mon Oct 08 08:44:16 2018 +0000
- Revision:
- 49:b1ac7ebb715f
- Parent:
- 48:824fda6804f1
- Child:
- 52:d49b6f468b97
change HP20x lib
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MathieuM | 0:fa6e7dd26ef2 | 1 | #include "mbed.h" |
| MathieuM | 45:60f602ecd59b | 2 | #include "config.h" |
| MathieuM | 45:60f602ecd59b | 3 | #include "communication.h" |
| MathieuM | 46:40b6bbf6167e | 4 | #include "T_H_air.h" |
| MathieuM | 49:b1ac7ebb715f | 5 | #include "altitude.h" |
| MathieuM | 49:b1ac7ebb715f | 6 | |
| MathieuM | 0:fa6e7dd26ef2 | 7 | |
| MathieuM | 45:60f602ecd59b | 8 | Serial wisol(SERIAL_PORT); |
| MathieuM | 49:b1ac7ebb715f | 9 | Serial pc(USBTX, USBRX); |
| MathieuM | 46:40b6bbf6167e | 10 | DHT sensor(PIN_NAME, DHTtype); |
| MathieuM | 49:b1ac7ebb715f | 11 | I2C hp206c(D12, A6); |
| MathieuM | 0:fa6e7dd26ef2 | 12 | |
| MathieuM | 0:fa6e7dd26ef2 | 13 | int main() { |
| MathieuM | 0:fa6e7dd26ef2 | 14 | while(1) { |
| MathieuM | 46:40b6bbf6167e | 15 | float airH, airT; |
| MathieuM | 46:40b6bbf6167e | 16 | char *message; |
| MathieuM | 33:2a6476c33e74 | 17 | /* |
| MathieuM | 33:2a6476c33e74 | 18 | read T&H air |
| MathieuM | 33:2a6476c33e74 | 19 | read T sol |
| MathieuM | 33:2a6476c33e74 | 20 | read H sol |
| MathieuM | 33:2a6476c33e74 | 21 | read Pressure |
| MathieuM | 33:2a6476c33e74 | 22 | read Magnetic |
| MathieuM | 33:2a6476c33e74 | 23 | |
| MathieuM | 33:2a6476c33e74 | 24 | m = genMessage(T_air, H_air, T_sol, H_sol, Pressure, Mag) |
| MathieuM | 33:2a6476c33e74 | 25 | sendMessage(m) |
| MathieuM | 33:2a6476c33e74 | 26 | */ |
| MathieuM | 49:b1ac7ebb715f | 27 | airH = airHumidity(sensor); |
| MathieuM | 49:b1ac7ebb715f | 28 | airT = airTemperature(sensor); |
| MathieuM | 48:824fda6804f1 | 29 | //message = genMessage(airT, airH); |
| MathieuM | 48:824fda6804f1 | 30 | //wisol.printf("AT$SF=%s\r\n", message); |
| MathieuM | 49:b1ac7ebb715f | 31 | unsigned long alt = readAltitude(&hp206c); |
| MathieuM | 49:b1ac7ebb715f | 32 | pc.printf("H air : %f\n", airH); |
| MathieuM | 49:b1ac7ebb715f | 33 | pc.printf("T air : %f\n", airT); |
| MathieuM | 49:b1ac7ebb715f | 34 | pc.printf("altitude : %lu\n", alt); |
| MathieuM | 49:b1ac7ebb715f | 35 | wait(1); |
| MathieuM | 0:fa6e7dd26ef2 | 36 | } |
| MathieuM | 0:fa6e7dd26ef2 | 37 | } |
