p5e7

Dependencies:   mbed

Committer:
isaacross99
Date:
Thu Oct 31 04:24:48 2019 +0000
Revision:
31:080589c1250a
Parent:
30:f7518060fc89
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:080589c1250a 3 DigitalOut led0(PTD0); //Octavo pin (a partir del botón de RESET).
isaacross99 31:080589c1250a 4 DigitalOut led1(PTC4); //Noveno pin.
isaacross99 31:080589c1250a 5 DigitalOut led2(PTC12); //Decimo pin.
isaacross99 31:080589c1250a 6 DigitalOut led3(PTC3); //Onceavo pin (inicia en el nuevo carril).
isaacross99 31:080589c1250a 7 Timer crono;
isaacross99 30:f7518060fc89 8
isaacross99 29:734b61eca6df 9 int main(){
isaacross99 31:080589c1250a 10 led0 = 1;
isaacross99 31:080589c1250a 11 led1 = 1;
isaacross99 31:080589c1250a 12 led2 = 1;
isaacross99 31:080589c1250a 13 led3 = 1;
isaacross99 31:080589c1250a 14 crono.start();
isaacross99 31:080589c1250a 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:080589c1250a 16 led0 = 0;
isaacross99 31:080589c1250a 17 led1 = 1;
isaacross99 31:080589c1250a 18 led2 = 0;
isaacross99 31:080589c1250a 19 led3 = 1;
isaacross99 31:080589c1250a 20 wait(0.025‬‬);
isaacross99 31:080589c1250a 21 led0 = 0;
isaacross99 31:080589c1250a 22 led1 = 1;
isaacross99 31:080589c1250a 23 led2 = 1;
isaacross99 31:080589c1250a 24 led3 = 0;
isaacross99 31:080589c1250a 25 wait(0.025‬);
isaacross99 31:080589c1250a 26 led0 = 1;
isaacross99 31:080589c1250a 27 led1 = 0;
isaacross99 31:080589c1250a 28 led2 = 1;
isaacross99 31:080589c1250a 29 led3 = 0;
isaacross99 31:080589c1250a 30 wait(0.025‬);
isaacross99 31:080589c1250a 31 led0 = 1;
isaacross99 31:080589c1250a 32 led1 = 0;
isaacross99 31:080589c1250a 33 led2 = 0;
isaacross99 31:080589c1250a 34 led3 = 1;
isaacross99 31:080589c1250a 35 wait(0.025‬);
isaacross99 31:080589c1250a 36 }
isaacross99 31:080589c1250a 37 crono.stop();
isaacross99 31:080589c1250a 38 pc.printf("Tiempo de giro: %f seg", crono.read());
isaacross99 28:868b283c5f77 39 }