Motor

Dependencies:   mbed

Fork of BERTL14_MOTOR_PWM by Wolfgang Raimann

main.cpp

Committer:
Matthias_Praja
Date:
2016-01-08
Revision:
1:75558096c7e0
Parent:
0:8487a0785e95

File content as of revision 1:75558096c7e0:

/***********************************
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 = 1
    MotorR_FORWARD = 0;
    // Periodendauer wird eingestellt
    MotorL_EN.period_ms(10);
    MotorR_EN.period_ms(10);
    
    while(1) {
        MotorL_EN = 10.0f;
        MotorR_EN.pulsewidth_ms(5);
        
        MotorL_EN = 10.0f;
        MotorR_EN.pulsewidth_ms(0);
        
    }
}