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@71:b31e3ee29dd0, 2018-10-09 (annotated)
- Committer:
- SBACCARI
- Date:
- Tue Oct 09 15:35:04 2018 +0000
- Revision:
- 71:b31e3ee29dd0
- Parent:
- 69:9ad4bce37c63
- Parent:
- 70:1e2e21c377ed
- Child:
- 72:f678052af558
merge changes 2
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" |
| SBACCARI | 67:3ccbc6a532eb | 5 | #include "T_H_soil.h" |
| MathieuM | 49:b1ac7ebb715f | 6 | #include "altitude.h" |
| MathieuM | 52:d49b6f468b97 | 7 | #include "HMC5883L.h" |
| MathieuM | 49:b1ac7ebb715f | 8 | |
| MathieuM | 0:fa6e7dd26ef2 | 9 | |
| MathieuM | 45:60f602ecd59b | 10 | Serial wisol(SERIAL_PORT); |
| MathieuM | 49:b1ac7ebb715f | 11 | Serial pc(USBTX, USBRX); |
| MathieuM | 46:40b6bbf6167e | 12 | DHT sensor(PIN_NAME, DHTtype); |
| SBACCARI | 66:cbfcea17a3c5 | 13 | HP20x_dev barometre(HP20X_I2C_PORT); |
| MathieuM | 52:d49b6f468b97 | 14 | HMC5883L hmc5883(HMC5883_I2C_PORT); |
| MathieuM | 0:fa6e7dd26ef2 | 15 | |
| MathieuM | 0:fa6e7dd26ef2 | 16 | int main() { |
| SBACCARI | 70:1e2e21c377ed | 17 | barometre.reset(); |
| MathieuM | 0:fa6e7dd26ef2 | 18 | while(1) { |
| SBACCARI | 62:d902b1e77094 | 19 | float airH = 0,airT = 0; |
| MathieuM | 52:d49b6f468b97 | 20 | int16_t magXYZ[3]; |
| SBACCARI | 66:cbfcea17a3c5 | 21 | long P = 0; |
| SBACCARI | 54:61d003e0754d | 22 | |
| SBACCARI | 54:61d003e0754d | 23 | //collect data |
| MathieuM | 52:d49b6f468b97 | 24 | hmc5883.getXYZ(magXYZ); |
| SBACCARI | 65:3f898ad77cb5 | 25 | get_T_H_air(&airT, &airH, sensor); // takes 2s to execute |
| SBACCARI | 67:3ccbc6a532eb | 26 | P = pression(&barometre); |
| MathieuM | 55:887edb961698 | 27 | |
| MathieuM | 55:887edb961698 | 28 | // Display |
| MathieuM | 55:887edb961698 | 29 | pc.printf("\n=====| Data |=====\n"); |
| SBACCARI | 67:3ccbc6a532eb | 30 | pc.printf("H air : %.2f %%\r\n", airH); |
| SBACCARI | 70:1e2e21c377ed | 31 | pc.printf("T air : %.2f C\r\n", airT); |
| SBACCARI | 70:1e2e21c377ed | 32 | pc.printf("Pression : %ul Pa\r\n", P); |
| MathieuM | 52:d49b6f468b97 | 33 | pc.printf("Mag : X:%d ; Y:%d ; Z:%d\n", magXYZ[0], magXYZ[1], magXYZ[2]); |
| MathieuM | 53:a0752606d02c | 34 | wait(5); |
| MathieuM | 0:fa6e7dd26ef2 | 35 | } |
| MathieuM | 0:fa6e7dd26ef2 | 36 | } |
