110_robot_H_Bridge8835_UserButton_DIR_PWM

main.cpp

Committer:
itbusch
Date:
2022-01-31
Revision:
0:f53860730a45
Child:
1:2849454dd0ab

File content as of revision 0:f53860730a45:

/* mbed BuschA
 */

#include "mbed.h"

DigitalIn CableSwitch(D2); //PullUp auf Board, PA_10
PwmOut M1_PWM(D9);          
DigitalOut M1_DIR(D7);


int main()
{
  M1_PWM.period_ms(10);        // PWM-Periode
    while (1) 
    {
    if (CableSwitch == false)
        {
        M1_DIR = 1;
        M1_PWM = 0.5;           //Tastgrad 0-1 
        }
    else
        {
        M1_DIR = 1;
        M1_PWM = 0.95;
        }
    }
}