Servo Motor Kutuphanesi(Library)
Dependents: RTOS_servo_motor step_servo_potile_motor thread_servo_led
servo.cpp@1:d9dc08980d89, 2019-12-21 (annotated)
- Committer:
- marvas
- Date:
- Sat Dec 21 09:55:34 2019 +0000
- Revision:
- 1:d9dc08980d89
- Parent:
- 0:a693d4a007d6
servo sinyal pini private public olarak degisti
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marvas | 0:a693d4a007d6 | 1 | #include "servo.h" |
marvas | 0:a693d4a007d6 | 2 | |
marvas | 0:a693d4a007d6 | 3 | /* |
marvas | 0:a693d4a007d6 | 4 | Copyright (c) |
marvas | 0:a693d4a007d6 | 5 | Kutuphaneyi yazan(Author): Egitimci/Yazar - Mehmet Akif ARVAS |
marvas | 0:a693d4a007d6 | 6 | |
marvas | 0:a693d4a007d6 | 7 | Yazarin Kitaplari: |
marvas | 0:a693d4a007d6 | 8 | |
marvas | 0:a693d4a007d6 | 9 | Arm islemci Programlama - Seckin Yayincilik |
marvas | 0:a693d4a007d6 | 10 | Buy(Satın alma linki): https://www.seckin.com.tr/kitap/926844928 |
marvas | 0:a693d4a007d6 | 11 | |
marvas | 0:a693d4a007d6 | 12 | Arduino ile robotik programlama - Seckin Yayincilik |
marvas | 0:a693d4a007d6 | 13 | Buy(Satın alma linki): https://www.seckin.com.tr/kitap/469991743 |
marvas | 0:a693d4a007d6 | 14 | |
marvas | 0:a693d4a007d6 | 15 | twitter: @arvasmehmetakif |
marvas | 0:a693d4a007d6 | 16 | instagram: @arvasmehmetakif |
marvas | 0:a693d4a007d6 | 17 | */ |
marvas | 0:a693d4a007d6 | 18 | |
marvas | 0:a693d4a007d6 | 19 | servo::servo(PinName pa) : sinyalpini(pa) {} |
marvas | 0:a693d4a007d6 | 20 | |
marvas | 0:a693d4a007d6 | 21 | |
marvas | 0:a693d4a007d6 | 22 | int servo::derece(int deger) { |
marvas | 0:a693d4a007d6 | 23 | |
marvas | 0:a693d4a007d6 | 24 | |
marvas | 0:a693d4a007d6 | 25 | int a=600+deger*9; |
marvas | 0:a693d4a007d6 | 26 | for(uint8_t x=0;x<20;x++) |
marvas | 0:a693d4a007d6 | 27 | { |
marvas | 0:a693d4a007d6 | 28 | sinyalpini=1; |
marvas | 0:a693d4a007d6 | 29 | wait_us(a); |
marvas | 0:a693d4a007d6 | 30 | sinyalpini=0; |
marvas | 0:a693d4a007d6 | 31 | wait_us(20000-a); |
marvas | 0:a693d4a007d6 | 32 | } |
marvas | 0:a693d4a007d6 | 33 | |
marvas | 0:a693d4a007d6 | 34 | return 0; |
marvas | 0:a693d4a007d6 | 35 | |
marvas | 0:a693d4a007d6 | 36 | } |