Testprogramm fuer den SMD IoTKit Shield.

Dependencies:   MFRC522 RemoteIR Servo StepperMotorUni mbed-rtos mbed ESP8266 RCSwitch SAA1064 TMP175

Committer:
marcel1691
Date:
Mon Mar 23 08:58:42 2015 +0000
Revision:
0:1b22732d0d8d
Testprogramm fuer den SMD IoTKit Shield.

Who changed what in which revision?

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