Notice: Please use two pins which use same TIMER to synchronize timer phase. Sample program: http://mbed.org/users/spiralray/code/Nucleo_motor_LockedAntiphase/
Dependents: Nucleo_motor_LockedAntiphase
motor_lockedantiphase.cpp@0:62943ca4f7a0, 2014-04-23 (annotated)
- Committer:
- spiralray
- Date:
- Wed Apr 23 16:32:53 2014 +0000
- Revision:
- 0:62943ca4f7a0
A motor control library using two PWM outputs.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spiralray | 0:62943ca4f7a0 | 1 | /* |
spiralray | 0:62943ca4f7a0 | 2 | * motor_lockedantiphase.cpp |
spiralray | 0:62943ca4f7a0 | 3 | * |
spiralray | 0:62943ca4f7a0 | 4 | * Created on: 2014/04/23 |
spiralray | 0:62943ca4f7a0 | 5 | * Author: spiralray |
spiralray | 0:62943ca4f7a0 | 6 | */ |
spiralray | 0:62943ca4f7a0 | 7 | |
spiralray | 0:62943ca4f7a0 | 8 | #include "motor_lockedantiphase.h" |
spiralray | 0:62943ca4f7a0 | 9 | |
spiralray | 0:62943ca4f7a0 | 10 | Motor_LockedAntiphase::Motor_LockedAntiphase(PwmOut ma, PwmOut mb): motora(ma), motorb(mb){ |
spiralray | 0:62943ca4f7a0 | 11 | motora.period_us(50); |
spiralray | 0:62943ca4f7a0 | 12 | motorb.period_us(50); |
spiralray | 0:62943ca4f7a0 | 13 | motora =0.5f; |
spiralray | 0:62943ca4f7a0 | 14 | motorb =0.5f; |
spiralray | 0:62943ca4f7a0 | 15 | } |
spiralray | 0:62943ca4f7a0 | 16 | |
spiralray | 0:62943ca4f7a0 | 17 | Motor_LockedAntiphase::~Motor_LockedAntiphase(){ |
spiralray | 0:62943ca4f7a0 | 18 | |
spiralray | 0:62943ca4f7a0 | 19 | } |