Matthias Praja
/
BERTL14_MOTOR_PWM
Motor
Fork of BERTL14_MOTOR_PWM by
main.cpp
- Committer:
- bulme_rai
- Date:
- 2014-05-20
- Revision:
- 0:8487a0785e95
- Child:
- 1:75558096c7e0
File content as of revision 0:8487a0785e95:
/*********************************** name: BERTL_2014_MOTOR_PWM author: Wolfgang Raimann email: rai@bulme.at description: Der Bertl dreht sich im Kreis für 1s mit 50% danach steht er für 1s ***********************************/ #include "mbed.h" PwmOut MotorL_EN(p34); DigitalOut MotorL_FORWARD(P1_0); DigitalOut MotorL_REVERSE(P1_1); PwmOut MotorR_EN(p36); DigitalOut MotorR_FORWARD(P1_3); DigitalOut MotorR_REVERSE(P1_4); int main() { // Richtungen werden bestimmt MotorL_FORWARD = MotorR_REVERSE = 1; // Periodendauer wird eingestellt MotorL_EN.period_ms(10); MotorR_EN.period_ms(10); while(1) { MotorL_EN = 0.5f; MotorR_EN.pulsewidth_ms(5); wait(1); MotorL_EN = 0.0f; MotorR_EN.pulsewidth_ms(0); wait(1); } }