![](/media/cache/group/mehmet_akif_arvas.jpg.50x50_q85.jpg)
thread ile servo motor, harici led ve kart ledi calistirma
Dependencies: mbed servo_motor mbed-rtos
main.cpp@0:dc00763ac8a7, 2019-12-21 (annotated)
- Committer:
- marvas
- Date:
- Sat Dec 21 06:50:03 2019 +0000
- Revision:
- 0:dc00763ac8a7
- Child:
- 1:d3dedfc5deda
mbed_rtos_2_led_yakma
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marvas | 0:dc00763ac8a7 | 1 | #include "mbed.h" |
marvas | 0:dc00763ac8a7 | 2 | #include "rtos.h" |
marvas | 0:dc00763ac8a7 | 3 | |
marvas | 0:dc00763ac8a7 | 4 | DigitalOut kart_led(PA_5); |
marvas | 0:dc00763ac8a7 | 5 | DigitalOut led(PD_2); |
marvas | 0:dc00763ac8a7 | 6 | |
marvas | 0:dc00763ac8a7 | 7 | Thread calisma1; |
marvas | 0:dc00763ac8a7 | 8 | |
marvas | 0:dc00763ac8a7 | 9 | void led_metodu() |
marvas | 0:dc00763ac8a7 | 10 | { |
marvas | 0:dc00763ac8a7 | 11 | while(true) { |
marvas | 0:dc00763ac8a7 | 12 | led=!led; |
marvas | 0:dc00763ac8a7 | 13 | wait_ms(100); |
marvas | 0:dc00763ac8a7 | 14 | } |
marvas | 0:dc00763ac8a7 | 15 | } |
marvas | 0:dc00763ac8a7 | 16 | int main() |
marvas | 0:dc00763ac8a7 | 17 | { |
marvas | 0:dc00763ac8a7 | 18 | calisma1.start(led_metodu); |
marvas | 0:dc00763ac8a7 | 19 | while(true) { |
marvas | 0:dc00763ac8a7 | 20 | kart_led=!kart_led; |
marvas | 0:dc00763ac8a7 | 21 | wait(2); |
marvas | 0:dc00763ac8a7 | 22 | } |
marvas | 0:dc00763ac8a7 | 23 | } |