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.
motor.cpp
00001 /* 00002 * 00003 * This program is free software; you can redistribute it and/or modify 00004 * it under the terms of the GNU General Public License as published by 00005 * the Free Software Foundation; either version 3 of the License, or 00006 * (at your option) any later version. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 * 00016 * @file motor.cpp 00017 * @author Andre Moehl 00018 * @date 01/2011 00019 * @brief Servo Motor Class definition 00020 */ 00021 00022 /*--- Includes ------------------------*/ 00023 #include "motor.h" 00024 00025 // Constructor 00026 Motor::Motor(PinName Pin, int periode): _PwmPin(Pin) 00027 { 00028 _PwmPin.period_ms(periode); 00029 } 00030 00031 // Destructor 00032 Motor::~Motor() 00033 { 00034 _PwmPin.pulsewidth_us(0); 00035 } 00036 00037 00038 // set the pwm pulse witdh 00039 void Motor::speed(int value) 00040 { 00041 _PwmPin.pulsewidth_us(value); 00042 } 00043
Generated on Thu Jul 14 2022 18:59:33 by
1.7.2