practica 2 ejercicio 9

Dependencies:   mbed-rtos mbed

main.cpp

Committer:
carlospomar
Date:
19 months ago
Revision:
1:bfed5e20331a
Parent:
0:f2a8b489600e

File content as of revision 1:bfed5e20331a:

#include "mbed.h"
#include "rtos.h"

DigitalIn Sw(A5);
DigitalOut Led(D4);
int estado=1;

void threadled(void const *argument)
{
    while (1) {
        Thread::signal_wait(0x1);
        Led = !Led;

    }
}

int main()
{
    Thread thread(threadled, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);

    while (true) {
        if (estado&&(!Sw)) {
            thread.signal_set(0x1);
        }
        estado=Sw;
        Thread::wait(200);
    }
}