![](/media/cache/group/mehmet_akif_arvas.jpg.50x50_q85.jpg)
thread ve servo motor kullanimi
Dependencies: mbed servo_motor mbed-rtos
Diff: main.cpp
- Revision:
- 0:3221160b3d1f
diff -r 000000000000 -r 3221160b3d1f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 17 12:55:58 2019 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "rtos.h" +#include "servo.h" +Thread servo_calismasi; +DigitalOut led(PA_5); +servo motor(PC_8); + +void motor_calismasi() +{ + while(1) + { + motor.derece(5); + wait(1); + motor.derece(90); + wait(1); + motor.derece(120); + wait(1); + motor.derece(150); + wait(1); + motor.derece(175); + wait(1); + } + } + +int main() +{ +servo_calismasi.start(motor_calismasi);//thread başlatma ve fonkisyona yönlendirme + while(true) { +led=!led; +wait(1); + + } + return 0; +} \ No newline at end of file