Jack Hansdampf / MotorinoLib

Dependents:   Motorino_Lib xxx_Motorino_Lib

Kanal.h

Committer:
jack1930
Date:
2021-09-28
Revision:
2:29582cbece6d
Parent:
1:33cca476d387
Child:
3:d53e45e1acae

File content as of revision 2:29582cbece6d:

/** 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();
    /** Abfrage, 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);
};