Simple PID example for LabVIEW

Dependencies:   mbed

Committer:
simon
Date:
Tue Aug 03 15:32:30 2010 +0000
Revision:
1:ddfe18427154

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:ddfe18427154 1 /* mbed simple H-bridge motor controller
simon 1:ddfe18427154 2 * Copyright (c) 2007-2010, sford
simon 1:ddfe18427154 3 *
simon 1:ddfe18427154 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:ddfe18427154 5 * of this software and associated documentation files (the "Software"), to deal
simon 1:ddfe18427154 6 * in the Software without restriction, including without limitation the rights
simon 1:ddfe18427154 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:ddfe18427154 8 * copies of the Software, and to permit persons to whom the Software is
simon 1:ddfe18427154 9 * furnished to do so, subject to the following conditions:
simon 1:ddfe18427154 10 *
simon 1:ddfe18427154 11 * The above copyright notice and this permission notice shall be included in
simon 1:ddfe18427154 12 * all copies or substantial portions of the Software.
simon 1:ddfe18427154 13 *
simon 1:ddfe18427154 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:ddfe18427154 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:ddfe18427154 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:ddfe18427154 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:ddfe18427154 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:ddfe18427154 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:ddfe18427154 20 * THE SOFTWARE.
simon 1:ddfe18427154 21 */
simon 1:ddfe18427154 22
simon 1:ddfe18427154 23 #ifndef MBED_MOTOR_H
simon 1:ddfe18427154 24 #define MBED_MOTOR_H
simon 1:ddfe18427154 25
simon 1:ddfe18427154 26 #include "mbed.h"
simon 1:ddfe18427154 27
simon 1:ddfe18427154 28 /** Interface to control a standard DC motor
simon 1:ddfe18427154 29 * with an H-bridge using a PwmOut and 2 DigitalOuts
simon 1:ddfe18427154 30 */
simon 1:ddfe18427154 31 class Motor {
simon 1:ddfe18427154 32 public:
simon 1:ddfe18427154 33
simon 1:ddfe18427154 34 /** Create a motor control interface
simon 1:ddfe18427154 35 *
simon 1:ddfe18427154 36 * @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed
simon 1:ddfe18427154 37 * @param fwd A DigitalOut, set high when the motor should go forward
simon 1:ddfe18427154 38 * @param rev A DigitalOut, set high when the motor should go backwards
simon 1:ddfe18427154 39 */
simon 1:ddfe18427154 40 Motor(PinName pwm, PinName fwd, PinName rev);
simon 1:ddfe18427154 41
simon 1:ddfe18427154 42 /** Set the speed of the motor
simon 1:ddfe18427154 43 *
simon 1:ddfe18427154 44 * @param speed The speed of the motor as a normalised value between -1.0 and 1.0
simon 1:ddfe18427154 45 */
simon 1:ddfe18427154 46 void speed(float speed);
simon 1:ddfe18427154 47
simon 1:ddfe18427154 48 protected:
simon 1:ddfe18427154 49 PwmOut _pwm;
simon 1:ddfe18427154 50 DigitalOut _fwd;
simon 1:ddfe18427154 51 DigitalOut _rev;
simon 1:ddfe18427154 52
simon 1:ddfe18427154 53 };
simon 1:ddfe18427154 54
simon 1:ddfe18427154 55 #endif