Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Motorino_Lib xxx_Motorino_Lib
Kanal.h
00001 /** Verwendet Motorino,h 00002 * mbed Library to use a Motorino shield from Joy IT 00003 * Copyright (c) 2021 Jörg Sturm 00004 * Released under the MIT License: http://mbed.org/license/mit 00005 * 00006 * Example: 00007 * @code 00008 * #include "Kanal.h" 00009 00010 * Kanal achse(0); //PWM-Kanal 0 wird für den Servo benutzt 00011 * int main() { 00012 * while(1) { 00013 achse.go(180,1000); //180° in 1000ms 00014 while (achse.isBusy(); //warte solange beschäftigt 00015 * } 00016 * } 00017 * @endcode 00018 */ 00019 #include "Motorino.h" 00020 00021 class Kanal 00022 { 00023 private: 00024 Motorino *meinMotorino; 00025 int nr; 00026 Thread *Bewegung; 00027 float w_alt, w_ziel; 00028 float dw; 00029 int zyklen; 00030 bool busy=false; 00031 float start=2, end=12.5; 00032 public: 00033 /** Create Kanal Instance 00034 @param nr 0..15 Kanalnummer 00035 */ 00036 Kanal(int nr); 00037 Kanal(); 00038 /** Drehe den Servo um Winkel 00039 @param w: Winkel 0.. 180° 00040 @param zeit: Zeit für die Bewegung in ms 00041 */ 00042 void go(float w, int zeit); 00043 void grundstellung(float w); 00044 void fahre(); 00045 /** Abfrage, ob die Bewegung läuft 00046 */ 00047 bool isBusy(); 00048 /** Setzt Tastgrad für 0 und 180° 00049 @param pStart: Tastgrad für 0° default. 5 für 5% 00050 @param pEnd: Tastgrad für 180° default. 10 für 10% 00051 */ 00052 void setStartEnd(float pStart, float pEnd); 00053 };
Generated on Mon Sep 5 2022 02:15:19 by
1.7.2