Rtos kullanimi

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "rtos.h"
00003 
00004 Thread calisma1,calisma2;
00005 
00006 DigitalOut kart_ledi(PA_5);
00007 DigitalOut led(PA_14);
00008 DigitalOut bzr(PB_7);
00009 
00010 void thread_led()
00011 {
00012     while(1)
00013     {
00014         led=!led;
00015         wait(1);
00016   
00017         }
00018     }
00019     void thread_bzr()
00020 {
00021     while(1)
00022     {
00023         bzr=!bzr;
00024         printf("Buzzer %x",bzr);
00025         wait_ms(500);
00026   
00027         }
00028     }
00029 
00030 int main()
00031 {
00032 calisma1.start(thread_led);
00033 calisma2.start(thread_bzr);
00034     while(true) {
00035 kart_ledi=!kart_ledi;
00036 wait_ms(100);
00037     }
00038     return 0;
00039 }