Equipo 3 - Examen

Dependencies:   mbed

Committer:
isaacross99
Date:
Thu Oct 31 04:24:05 2019 +0000
Revision:
31:6c36768769ea
Parent:
30:f7518060fc89
Child:
32:b229ddfa279f
0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan 0:7dec7e9ac085 1 #include "mbed.h"
rgsbuap 26:29f649949409 2 Serial pc(USBTX,USBRX);
isaacross99 31:6c36768769ea 3 DigitalOut led0(PTD0); //Octavo pin (a partir del botón de RESET).
isaacross99 31:6c36768769ea 4 DigitalOut led1(PTC4); //Noveno pin.
isaacross99 31:6c36768769ea 5 DigitalOut led2(PTC12); //Decimo pin.
isaacross99 31:6c36768769ea 6 DigitalOut led3(PTC3); //Onceavo pin (inicia en el nuevo carril).
isaacross99 31:6c36768769ea 7 Timer crono;
isaacross99 30:f7518060fc89 8
isaacross99 29:734b61eca6df 9 int main(){
isaacross99 31:6c36768769ea 10 led0 = 1;
isaacross99 31:6c36768769ea 11 led1 = 1;
isaacross99 31:6c36768769ea 12 led2 = 1;
isaacross99 31:6c36768769ea 13 led3 = 1;
isaacross99 31:6c36768769ea 14 crono.start();
isaacross99 31:6c36768769ea 15 for(int i; i < 50; i++){ // Dado que la resolución es de 1.8 grados, se necesitan 200 pasos para completar un giro.
isaacross99 31:6c36768769ea 16 led0 = 0;
isaacross99 31:6c36768769ea 17 led1 = 1;
isaacross99 31:6c36768769ea 18 led2 = 0;
isaacross99 31:6c36768769ea 19 led3 = 1;
isaacross99 31:6c36768769ea 20 wait(0.1‬);
isaacross99 31:6c36768769ea 21 led0 = 0;
isaacross99 31:6c36768769ea 22 led1 = 1;
isaacross99 31:6c36768769ea 23 led2 = 1;
isaacross99 31:6c36768769ea 24 led3 = 0;
isaacross99 31:6c36768769ea 25 wait(0.1);
isaacross99 31:6c36768769ea 26 led0 = 1;
isaacross99 31:6c36768769ea 27 led1 = 0;
isaacross99 31:6c36768769ea 28 led2 = 1;
isaacross99 31:6c36768769ea 29 led3 = 0;
isaacross99 31:6c36768769ea 30 wait(0.1);
isaacross99 31:6c36768769ea 31 led0 = 1;
isaacross99 31:6c36768769ea 32 led1 = 0;
isaacross99 31:6c36768769ea 33 led2 = 0;
isaacross99 31:6c36768769ea 34 led3 = 1;
isaacross99 31:6c36768769ea 35 wait(0.1);
isaacross99 31:6c36768769ea 36 }
isaacross99 31:6c36768769ea 37 crono.stop();
isaacross99 31:6c36768769ea 38 pc.printf("Tiempo de giro: %f seg", crono.read());
isaacross99 28:868b283c5f77 39 }