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@1:4adcf3181cd9, 2020-02-06 (annotated)
- Committer:
- edinson
- Date:
- Thu Feb 06 18:00:26 2020 +0000
- Revision:
- 1:4adcf3181cd9
- Parent:
- 0:cc8bd3ea02e4
- Child:
- 2:7ba2acf592f7
Avance de datos temperatura, voltaje y tiempo de lectura
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| edinson | 0:cc8bd3ea02e4 | 1 | #include "mbed.h" |
| edinson | 0:cc8bd3ea02e4 | 2 | |
| edinson | 1:4adcf3181cd9 | 3 | Timer t; \\ declaracion de contador |
| edinson | 1:4adcf3181cd9 | 4 | AnalogIn sensor(PB_0); \\ entrada analogica para sensor de temperatura |
| edinson | 1:4adcf3181cd9 | 5 | Serial device(PA_2,PA_3);\\ comunicacion seria |
| edinson | 1:4adcf3181cd9 | 6 | float value; \\variable para datos de temparatura |
| edinson | 1:4adcf3181cd9 | 7 | float volt; \\ variable para datos de voltaje |
| edinson | 0:cc8bd3ea02e4 | 8 | int main() { |
| edinson | 1:4adcf3181cd9 | 9 | device.baud(115200); |
| edinson | 1:4adcf3181cd9 | 10 | while(1) { \\ inicio de bucle |
| edinson | 1:4adcf3181cd9 | 11 | t.start(); \\ inicio de contador |
| edinson | 1:4adcf3181cd9 | 12 | value = (((sensor.read()*5000)/10)-25); \\ calculo para prsentar tempertura |
| edinson | 1:4adcf3181cd9 | 13 | volt = (value*10);\\ calculo para presentar voltaje de sensor |
| edinson | 1:4adcf3181cd9 | 14 | device.printf ("time= %d ms\r\n", t.read_ms()); \\ escribir datos de tiempor de lectura |
| edinson | 1:4adcf3181cd9 | 15 | t.stop(); \\pausa de contador |
| edinson | 1:4adcf3181cd9 | 16 | device.printf ("Temp= %2.2f C\r\n", value); \\ escribir dato de temperatura |
| edinson | 1:4adcf3181cd9 | 17 | device.printf ("vot= %2.2f mv\r\n", volt); \\ escribir dato de voltaje sensor |
| edinson | 1:4adcf3181cd9 | 18 | wait (1); |
| edinson | 1:4adcf3181cd9 | 19 | } |
| edinson | 0:cc8bd3ea02e4 | 20 | } |