Test moteur

Dependencies:   Encoder_Nucleo_16_bits PwmIn mbed

Fork of TestBoardv2_boussole_pixi by ilan Sandoz

main.cpp

Committer:
Dvlader
Date:
2017-06-09
Revision:
9:53dd6df76cf8
Parent:
8:527f5db9b3dc
Child:
10:a98764d33fd5

File content as of revision 9:53dd6df76cf8:

#include "mbed.h"
#include "PwmIn.h"
#include "Nucleo_Encoder_16_bits.h"

#define Rotation 1, 100, -1, 100
#define Vitesse1 1, 50, 1, 50
#define Vitesse2 1, 100, 1, 100

PwmOut      Pwm_MG  (PB_10);
PwmOut      Pwm_MD  (PB_3);
DigitalOut  En      (PC_9);
DigitalOut  SensG   (PC_8);
DigitalOut  SensD   (PC_6);

void moteur_command(double sensD, double pwmD, double sensG, double pwmG);

void main (void)
{
    moteur_command(Rotation);
    wait_ms(500);
    moteur_command(Vitesse1);
    wait_ms(500);
    moteur_command(Vitesse2);
    wait_ms(500);
    }

void moteur_command(double sensD, double pwmD, double sensG, double pwmG)
{
    En = 1;
    SensD = sensD;
    Pwm_MD = pwmD;
    SensG = sensG;
    Pwm_MG = pwmG;
}