Update for STM32 NUCLEO BOARD
Dependencies: TMP006_lib mbed
Fork of TMP006IR_HelloWorld by
main.cpp@0:a64de73cdc52, 2016-06-18 (annotated)
- Committer:
- cdupaty
- Date:
- Sat Jun 18 17:34:46 2016 +0000
- Revision:
- 0:a64de73cdc52
Update for STM32 NUCLEO BOARD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cdupaty | 0:a64de73cdc52 | 1 | // Test capteur de temperature distant TMP006 |
cdupaty | 0:a64de73cdc52 | 2 | // Realise a partir d'un document de Sam Kirsch. |
cdupaty | 0:a64de73cdc52 | 3 | // https://developer.mbed.org/users/sammacjunkie/notebook/tmp006-ir-temperature-sensor/ |
cdupaty | 0:a64de73cdc52 | 4 | // http://www.ti.com/product/TMP006 |
cdupaty | 0:a64de73cdc52 | 5 | |
cdupaty | 0:a64de73cdc52 | 6 | |
cdupaty | 0:a64de73cdc52 | 7 | // Adaptation pour carte Nucleo avec microcontroleur STM32 |
cdupaty | 0:a64de73cdc52 | 8 | // C.Dupaty 06-2016 |
cdupaty | 0:a64de73cdc52 | 9 | |
cdupaty | 0:a64de73cdc52 | 10 | #include "mbed.h" |
cdupaty | 0:a64de73cdc52 | 11 | #include "TMP006.h" |
cdupaty | 0:a64de73cdc52 | 12 | |
cdupaty | 0:a64de73cdc52 | 13 | #define Address 0x80 |
cdupaty | 0:a64de73cdc52 | 14 | |
cdupaty | 0:a64de73cdc52 | 15 | Serial pc(USBTX, USBRX); |
cdupaty | 0:a64de73cdc52 | 16 | DigitalOut led(LED1); |
cdupaty | 0:a64de73cdc52 | 17 | TMP006 sensor(PB_9, PB_8, Address); |
cdupaty | 0:a64de73cdc52 | 18 | |
cdupaty | 0:a64de73cdc52 | 19 | int main() |
cdupaty | 0:a64de73cdc52 | 20 | { |
cdupaty | 0:a64de73cdc52 | 21 | while(1) { |
cdupaty | 0:a64de73cdc52 | 22 | printf("Temperature: %f \r \n", sensor.readObjTempC(Address)); |
cdupaty | 0:a64de73cdc52 | 23 | led=1; |
cdupaty | 0:a64de73cdc52 | 24 | wait(0.3); |
cdupaty | 0:a64de73cdc52 | 25 | led=0; |
cdupaty | 0:a64de73cdc52 | 26 | wait(0.3); |
cdupaty | 0:a64de73cdc52 | 27 | } |
cdupaty | 0:a64de73cdc52 | 28 | } |