test

Dependencies:   mbed-rtos mbed

main.cpp

Committer:
joschaihl
Date:
2017-10-17
Revision:
0:ddc3e2b74e99

File content as of revision 0:ddc3e2b74e99:

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

void print_char(char c = '*')
{
    printf("%c", c);
    fflush(stdout);
}

DigitalOut led1(LED1);
DigitalOut led1(LED2);

void print_thread(void const *argument)
{
    while (true) {
        Thread::wait(1000);
        printf("Hallo Welt!!!\r\n");
        fflush(stdout);
    }
}

void t2(void const *arg) {
    while(true) {
        Thread::wait(100);
        led2 = !led2;
    }
}

int main()
{
    printf("\n\n*** RTOS basic example ***\n");
    Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
    Thread thread(t2, NULL, osPriorityNormal, DEFAULT_STACK_SIZE);
    while (true) {
        led1 = !led1;
        Thread::wait(500);
    }
}