np

xxx

30 Oct 2017
  1. include "mbed.h"
  2. include "rtos.h"

DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led4(LED4); Serial pc(USBTX, USBRX); tx, rx

Thread *(test); Thread *(test2);

void led2_thread(void const *args) { while (true) { led2 = !led2; Thread::wait(1000);

} }

void led4_thread(void const *args) { while (true) { led4 = !led4; Thread::wait(1000);

} }

int main() { Thread thread(led2_thread); test = &thread; test->set_priority(osPriorityHigh); Thread thread2(led4_thread); test2 = &thread2; test2->set_priority(osPriorityLow); pc.printf("%i\n\r",test->get_priority()); pc.printf("%i\n\r",test2->get_priority());

while (true) { led1 = !led1; Thread::wait(500);

} }