![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
aca igualmente
Diff: main.cpp
- Revision:
- 0:5dfb0aba18a3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 12 15:05:39 2021 +0000 @@ -0,0 +1,45 @@ +#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); + + } + } \ No newline at end of file