update

Dependencies:   mbed-STM32F103C8T6_new

main.cpp

Committer:
hankzhang
Date:
2020-04-16
Revision:
2:f48b0967b6cc
Parent:
1:0fe432e5dfc4
Child:
3:30d61fa10b98

File content as of revision 2:f48b0967b6cc:

#include "mbed.h"
#include "stm32f103c8t6.h"

DigitalOut led1(PC_13);

Serial pc(PA_9,PA_10);

 
void led2_thread() {
    while (true) {
        pc.printf("led2_thread\r\n");
        thread_sleep_for(4000);
    }
}

void led1_thread() {
    while (true) {
        pc.printf("led1_thread\r\n");
        thread_sleep_for(3000);
    }
} 

void led0_thread() {
    while (true) {
        pc.printf("led0_thread\r\n");
        thread_sleep_for(2000);
    }
}
int main() {
    pc.baud(115200);
    pc.printf("hello world\r\n");
    
    Thread thread0(osPriorityNormal, 512, nullptr, nullptr);
    Thread thread1(osPriorityNormal, 512, nullptr, nullptr);
    Thread thread2(osPriorityNormal, 512, nullptr, nullptr);
    
    thread0.start(led0_thread);
    thread1.start(led1_thread);
    thread2.start(led2_thread);
    
    while (true) {
        //led1 = !led1;
        thread_sleep_for(5000);
        pc.printf("+++++main task++++++\r\n");
    }
}