Simple test du capteur de température TMP102 La température est transmise sur UART virtuelle pour affichage dans un terminal La LED1 clignote pour signaler chaque mesure.
Fork of TMP102_HelloWorld by
Revision 2:0fba513ac57b, committed 2016-04-29
- Comitter:
- cdupaty
- Date:
- Fri Apr 29 06:39:49 2016 +0000
- Parent:
- 1:9b49379e8bf6
- Commit message:
- Simple test sur le capteur de temp?rature TMP102; Affichage sur un terminal par l'UART virtuelle de la temp?rature; LED1 clignote
Changed in this revision
diff -r 9b49379e8bf6 -r 0fba513ac57b TMP102.lib --- a/TMP102.lib Sat Jul 21 22:41:38 2012 +0000 +++ b/TMP102.lib Fri Apr 29 06:39:49 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/chris/code/TMP102/#7585766ad401 +http://mbed.org/users/chris/code/TMP102/#694792b93731
diff -r 9b49379e8bf6 -r 0fba513ac57b main.cpp --- a/main.cpp Sat Jul 21 22:41:38 2012 +0000 +++ b/main.cpp Fri Apr 29 06:39:49 2016 +0000 @@ -1,12 +1,17 @@ #include "mbed.h" #include "TMP102.h" -TMP102 temperature(p9, p10, 0x90); //A0 pin is connected to ground +DigitalOut led(LED1); +Serial pc(USBTX, USBRX); +TMP102 temperature(PB_9, PB_8, 0x90); //A0 pin is connected to ground int main() { - while(1) { - printf("Temperature: %f\n", temperature.read()); - wait(1.0); - } + while(1) { + pc.printf("Temperature: %f\n\r", temperature.read()); + led=0; + wait(0.5); + led=1; + wait(0.5); + } }
diff -r 9b49379e8bf6 -r 0fba513ac57b mbed.bld --- a/mbed.bld Sat Jul 21 22:41:38 2012 +0000 +++ b/mbed.bld Fri Apr 29 06:39:49 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb \ No newline at end of file