Practica_6_-_Ejercicio_02

Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
isaacross99
Date:
Wed Nov 20 05:03:04 2019 +0000
Parent:
31:080589c1250a
Commit message:
0;

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 080589c1250a -r ad8e0f2469c3 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Wed Nov 20 05:03:04 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r 080589c1250a -r ad8e0f2469c3 main.cpp
--- a/main.cpp	Thu Oct 31 04:24:48 2019 +0000
+++ b/main.cpp	Wed Nov 20 05:03:04 2019 +0000
@@ -1,39 +1,16 @@
 #include "mbed.h"
-Serial pc(USBTX,USBRX);
-DigitalOut led0(PTD0); //Octavo pin (a partir del botón de RESET).
-DigitalOut led1(PTC4); //Noveno pin.
-DigitalOut led2(PTC12); //Decimo pin.
-DigitalOut led3(PTC3); //Onceavo pin (inicia en el nuevo carril). 
-Timer crono;
+#include "TextLCD.h"
+TextLCD lcd(PTE24, PTE25, PTD1, PTD3, PTD2, PTD0, TextLCD::LCD16x2); // rs, e, d4-d7
 
-int main(){
-    led0 = 1;
-    led1 = 1;
-    led2 = 1;
-    led3 = 1;
-    crono.start();
-    for(int i; i < 50; i++){ // Dado que la resolución es de 1.8 grados, se necesitan 200 pasos para completar un giro.
-        led0 = 0;
-        led1 = 1;
-        led2 = 0;
-        led3 = 1;
-        wait(0.025‬‬);
-        led0 = 0;
-        led1 = 1;
-        led2 = 1;
-        led3 = 0;
-        wait(0.025‬);
-        led0 = 1;
-        led1 = 0;
-        led2 = 1;
-        led3 = 0;
-        wait(0.025‬);
-        led0 = 1;
-        led1 = 0;
-        led2 = 0;
-        led3 = 1;
-        wait(0.025‬);
+int main() {
+    int contador = 0, i = 0;
+    while(1){
+        for(i = 0; i <= 59; i++){
+            lcd.printf("%d", contador);
+            contador = contador + 1;
+            wait(1);
+            lcd.cls();
+        }
+        contador = 0;
     }
-    crono.stop();
-    pc.printf("Tiempo de giro: %f seg", crono.read());
-}
\ No newline at end of file
+}