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.
Diff: main.cpp
- Revision:
- 1:4adcf3181cd9
- Parent:
- 0:cc8bd3ea02e4
- Child:
- 2:7ba2acf592f7
diff -r cc8bd3ea02e4 -r 4adcf3181cd9 main.cpp
--- a/main.cpp Mon Feb 03 02:08:51 2020 +0000
+++ b/main.cpp Thu Feb 06 18:00:26 2020 +0000
@@ -1,12 +1,20 @@
#include "mbed.h"
-DigitalOut myled(LED1);
-
+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() {
- while(1) {
- myled = 1;
- wait(0.2);
- myled = 0;
- wait(0.2);
- }
+ 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);
+ }
}