![](/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
Diff: main.cpp
- Revision:
- 1:d3dedfc5deda
- Parent:
- 0:dc00763ac8a7
diff -r dc00763ac8a7 -r d3dedfc5deda main.cpp --- a/main.cpp Sat Dec 21 06:50:03 2019 +0000 +++ b/main.cpp Sat Dec 21 07:15:37 2019 +0000 @@ -1,10 +1,13 @@ #include "mbed.h" #include "rtos.h" +#include "servo.h" + +servo motor(PB_4); DigitalOut kart_led(PA_5); DigitalOut led(PD_2); -Thread calisma1; +Thread calisma1,calisma2; void led_metodu() { @@ -13,9 +16,25 @@ wait_ms(100); } } + +void servo_metodu() +{ + while(true) + { + motor.derece(5); + wait(1); + motor.derece(20); + wait(0.5f); + motor.derece(92); + wait(1); + motor.derece(175); + wait(1); + } + } int main() { calisma1.start(led_metodu); + calisma2.start(servo_metodu); while(true) { kart_led=!kart_led; wait(2);