kol

Dependencies:   mbed

main.cpp

Committer:
jon07
Date:
2017-11-09
Revision:
0:5827fd72218f

File content as of revision 0:5827fd72218f:

#include "mbed.h"
#include "rtos.h"
 
DigitalIn myswitch1(A5);
DigitalOut myled1(D4);
int estadoled1=1;
 
void thread_led1(void const *argument)
{
    while (1) {
        Thread::signal_wait(0x1);
        myled1 = !myled1;
 
    }
}
 
int main()
{
    Thread thread(thread_led1, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
 
    while (true) {
        if (estadoled1&&(!myswitch1)) {
            thread.signal_set(0x1);
            //thread.start(thread_led1);
 
        }
        estadoled1=myswitch1;
        Thread::wait(200);
    }
}