mehmet akif arvas / servo_motor

Dependents:   RTOS_servo_motor step_servo_potile_motor thread_servo_led

Files at this revision

API Documentation at this revision

Comitter:
marvas
Date:
Sun Dec 15 18:43:39 2019 +0000
Child:
1:d9dc08980d89
Commit message:
Servo Motor Kutuphanesi(Library)

Changed in this revision

servo.cpp Show annotated file Show diff for this revision Revisions of this file
servo.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/servo.cpp	Sun Dec 15 18:43:39 2019 +0000
@@ -0,0 +1,36 @@
+#include "servo.h"
+
+/*
+Copyright (c)
+Kutuphaneyi yazan(Author): Egitimci/Yazar - Mehmet Akif ARVAS
+
+Yazarin Kitaplari:
+
+Arm islemci Programlama - Seckin Yayincilik
+Buy(Satın alma linki): https://www.seckin.com.tr/kitap/926844928
+
+Arduino ile robotik programlama - Seckin Yayincilik
+Buy(Satın alma linki): https://www.seckin.com.tr/kitap/469991743
+
+twitter: @arvasmehmetakif
+instagram: @arvasmehmetakif
+*/
+
+servo::servo(PinName pa) : sinyalpini(pa) {}
+
+
+int servo::derece(int deger) {
+  
+  
+  int a=600+deger*9;
+  for(uint8_t x=0;x<20;x++)
+  {
+        sinyalpini=1;
+        wait_us(a);
+        sinyalpini=0;
+        wait_us(20000-a);
+        }
+        
+     return 0; 
+ 
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/servo.h	Sun Dec 15 18:43:39 2019 +0000
@@ -0,0 +1,80 @@
+
+/*
+
+Kutuphaneyi yazan(Author): Egitimci/Yazar - Mehmet Akif ARVAS
+
+Yazarin Kitaplari:
+
+Arm islemci Programlama - Seckin Yayincilik
+Buy(Satın alma linki): https://www.seckin.com.tr/kitap/926844928
+
+Arduino ile robotik programlama - Seckin Yayincilik
+Buy(Satın alma linki): https://www.seckin.com.tr/kitap/469991743
+
+twitter: @arvasmehmetakif
+instagram: @arvasmehmetakif
+
+*/
+
+/*
+
+//Ornek Kod(Example Code):
+
+//Koda başlangıcı:
+
+#include "mbed.h"
+#include "servo.h"
+
+servo motor(PA_0);
+
+int main()
+{
+
+    while(true) {
+    motor.derece(0);
+    wait(1);
+    motor.derece(45);
+wait(1);
+    motor.derece(90);
+        wait(1);
+
+    motor.derece(135);
+            wait(1);
+           motor.derece(180);
+        wait(1);
+    }
+
+}
+//Kod Sonu
+*/
+
+
+#ifndef servo_h
+#define servo_h
+
+#include "mbed.h"
+
+
+
+
+class servo {
+ 
+ 
+  public:
+ 
+ 
+    servo(PinName pa);
+ 
+     int derece(int deger);
+ 
+ 
+    private:
+
+        DigitalOut sinyalpini;
+
+
+};
+ 
+
+
+#endif
\ No newline at end of file