Spleisser Grundstrucktur

Dependencies:   mbed mbed-rtos X_NUCLEO_IHM02A1

PWM2.cpp

Committer:
hagenrap
Date:
2019-04-22
Revision:
34:0c111add045e

File content as of revision 34:0c111add045e:

#include "SETUP.h"

PwmOut pwmServo(SERVO);
PwmOut pwmCutter(CUTTER_ARC);
PwmOut pwmSpleisser_1(SPLEISSER_ARC_1);
PwmOut pwmSpleisser_2(SPLEISSER_ARC_2);


bool ServoInit = false;


float duty1 = (GOOD_FIL*0.2666666+22)/100;
float duty2 = (BAD_FIL*0.2666666+22)/100;


void Set_Cutter_ARC()
{
    pwmCutter.period(1/(float)FREQ_CUTTER);
    pwmCutter = (float)DUTY_CUTTER/100;
}

void Reset_Cutter_ARC()
{
    pwmCutter = 0;
}

void Set_SP_1_ARC()
{
    pwmSpleisser_1.period(1/(float)FREQ_SP_1);
    pwmSpleisser_1 = (float)DUTY_SP/100;
}

void Set_SP_2_ARC()
{
    pwmSpleisser_2.period(1/(float)FREQ_SP_2);
    pwmSpleisser_2 = (float)DUTY_SP/100;
}

void Reset_SP_ARC()
{
    pwmSpleisser_1= 0;
    pwmSpleisser_2= 0;
}

void Set_Servo_Good_Fil()
{
    if(ServoInit == false)
    {
        pwmServo.period(1/(float)SERVO_FR);
        ServoInit = true;
        
    }
    printf("pwm\n\r");
    pwmServo = duty1;

}

void Set_Servo_Bad_Fil()
{
    pwmServo.period(1/(float)SERVO_FR);
    pwmServo = duty2;
}