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
- Committer:
- edinson
- Date:
- 2020-02-06
- Revision:
- 1:4adcf3181cd9
- Parent:
- 0:cc8bd3ea02e4
- Child:
- 2:7ba2acf592f7
File content as of revision 1:4adcf3181cd9:
#include "mbed.h"
Timer t; \\ declaracion de contador
AnalogIn sensor(PB_0); \\ entrada analogica para sensor de temperatura
Serial device(PA_2,PA_3);\\ comunicacion seria
float value; \\variable para datos de temparatura
float volt; \\ variable para datos de voltaje
int main() {
device.baud(115200);
while(1) { \\ inicio de bucle
t.start(); \\ inicio de contador
value = (((sensor.read()*5000)/10)-25); \\ calculo para prsentar tempertura
volt = (value*10);\\ calculo para presentar voltaje de sensor
device.printf ("time= %d ms\r\n", t.read_ms()); \\ escribir datos de tiempor de lectura
t.stop(); \\pausa de contador
device.printf ("Temp= %2.2f C\r\n", value); \\ escribir dato de temperatura
device.printf ("vot= %2.2f mv\r\n", volt); \\ escribir dato de voltaje sensor
wait (1);
}
}