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@0:e7337a59d2ff, 2021-09-06 (annotated)
- Committer:
- louatayehh
- Date:
- Mon Sep 06 09:18:32 2021 +0000
- Revision:
- 0:e7337a59d2ff
Capteur 3: HDC1080
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| louatayehh | 0:e7337a59d2ff | 1 | // Capteur température |
| louatayehh | 0:e7337a59d2ff | 2 | |
| louatayehh | 0:e7337a59d2ff | 3 | #include "mbed.h" |
| louatayehh | 0:e7337a59d2ff | 4 | #include "HDC1080.h" |
| louatayehh | 0:e7337a59d2ff | 5 | |
| louatayehh | 0:e7337a59d2ff | 6 | Serial bluetooth(p9,p10); |
| louatayehh | 0:e7337a59d2ff | 7 | |
| louatayehh | 0:e7337a59d2ff | 8 | |
| louatayehh | 0:e7337a59d2ff | 9 | int main() |
| louatayehh | 0:e7337a59d2ff | 10 | { |
| louatayehh | 0:e7337a59d2ff | 11 | // Declarations |
| louatayehh | 0:e7337a59d2ff | 12 | PinName D_SDA; |
| louatayehh | 0:e7337a59d2ff | 13 | PinName D_SCL; |
| louatayehh | 0:e7337a59d2ff | 14 | HDC1080 TH_Sensor(D_SDA,D_SCL); |
| louatayehh | 0:e7337a59d2ff | 15 | float temperature; |
| louatayehh | 0:e7337a59d2ff | 16 | int signature; |
| louatayehh | 0:e7337a59d2ff | 17 | |
| louatayehh | 0:e7337a59d2ff | 18 | // Instructions |
| louatayehh | 0:e7337a59d2ff | 19 | signature = TH_Sensor.ReadSignature(); |
| louatayehh | 0:e7337a59d2ff | 20 | bluetooth.printf("Manufacturer ID : %d \r\n ", signature); |
| louatayehh | 0:e7337a59d2ff | 21 | |
| louatayehh | 0:e7337a59d2ff | 22 | while(1) |
| louatayehh | 0:e7337a59d2ff | 23 | { |
| louatayehh | 0:e7337a59d2ff | 24 | temperature = TH_Sensor.readTemperature(); |
| louatayehh | 0:e7337a59d2ff | 25 | bluetooth.printf(" Temperature C=%0.3f ", temperature); |
| louatayehh | 0:e7337a59d2ff | 26 | wait(2); |
| louatayehh | 0:e7337a59d2ff | 27 | } |
| louatayehh | 0:e7337a59d2ff | 28 | } |