Jack Hansdampf / MotorinoLib

Dependents:   Motorino_Lib xxx_Motorino_Lib

Revision:
0:9d4d08d4e918
Child:
1:33cca476d387
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Kanal.h	Tue Sep 28 15:44:00 2021 +0000
@@ -0,0 +1,52 @@
+/** Verwendet Motorino,h
+ * mbed Library to use a Motorino shield from Joy IT
+ * Copyright (c) 2021 Jörg Sturm
+ * Released under the MIT License: http://mbed.org/license/mit
+ *
+  * Example:
+ * @code
+ * #include "Kanal.h"
+
+ * Kanal achse;
+ * int main() {  
+ *     while(1)  {
+        achse.go(180.1000); //180° in 1000ms
+        while (achse.isBusy(); //warte solange beschäftigt
+ *     }
+ * }
+ * @endcode
+ */
+#include "Motorino.h"
+
+class Kanal
+{
+    private:
+        Motorino *meinMotorino;
+        int nr;
+        Thread *Bewegung;
+        float w_alt, w_ziel;
+        float dw;
+        int zyklen;
+        bool busy=false;
+        float start=5, end=10;
+    public:
+    /** Create Kanal Instance
+    @param nr 0..15 Kanalnummer
+    */
+        Kanal(int nr);
+        Kanal();
+    /** Drehe den Servo um Winkel
+    @param w: Winkel 0.. 180°
+    @param zeit: Zeit für die Bewegung in ms   
+    */
+        void go(float w, int zeit);
+        void fahre();
+    /** Abfraage, ob die Bewegung läuft
+    */   
+        bool isBusy();
+    /** Setzt Tastgrad für 0 und 180°
+    @param pStart: Tastgrad für 0° default. 5 für 5%
+    @param pEnd:   Tastgrad für 180° default. 10 für 10%
+    */    
+        void setStartEnd(float pStart, float pEnd);
+};
\ No newline at end of file