aca igualmente

Dependencies:   mbed

main.cpp

Committer:
dex2271
Date:
2021-08-12
Revision:
0:5dfb0aba18a3

File content as of revision 0:5dfb0aba18a3:

#include "mbed.h"
#define tiempo                  500
BusOut seg (D3,D4,D14,D6,D7,D8,D10);//abcdefg
char hex[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};
int a=0;
int b=0;
static int contador;
DigitalIn Boton(PA_0);
DigitalIn Boton2(D1);
DigitalOut led(D15);
DigitalOut led2(D13);
int main()
{

 
 while (1){
                 
                     while(!Boton2 and !Boton and a<=b){
                     seg=hex[contador];
                     led=0;
                    contador=contador+1;
                    thread_sleep_for(500);
                    if(Boton){
                          a=contador;
                          b=contador;
                          }
                          if(Boton2)
                      {
                          b=contador;
                          }
                    if(a<b){
                        led=1;
                        }
                        
                    
                      if(contador==10)
                      {
                        contador=0;       
                        }    
                        }
                        
                      if (a>b)(led2=!led);
                          
                        }  
                 }