.
Dependencies: L432KC_SPI_Pey_Lal
Diff: main.cpp
- Revision:
- 114:c1f7be27aa5d
- Parent:
- 113:2f8f255e99f2
- Child:
- 115:156b8234f2de
diff -r 2f8f255e99f2 -r c1f7be27aa5d main.cpp --- a/main.cpp Tue May 17 22:44:42 2022 +0000 +++ b/main.cpp Wed May 18 16:12:59 2022 +0000 @@ -7,22 +7,8 @@ #include "platform/mbed_thread.h" #include "protocol.h" #include "asservissement.hpp" - -//Define PWM -#define PWM_PROP D9 -#define PWM_DIR D10 - -//Define interrupt Input -#define SPEED_CAPTOR A4 - -//Define COEF -#define DISTANCE_FOR_HALF_TURN 3 * 3.14 //TODO: mettre vrai valeur -#define CONTROL_RATE 1000.0 - -//fontion interrupt -void onRxInterrupt(); -void onSpeedCaptorInterrupt(); -void onTickerAsservissementInterrupt(); +#include "toolbox.hpp" +#include "main.hpp" //Declaration PWM outputs PwmOut propulsion(PWM_PROP); @@ -92,9 +78,9 @@ } //Write in terminal - if (tTerminalWriting.read() > 0.1) + if (tTerminalWriting.read() > 0.02) { - sprintf(terminalOutput, "Vcons = %d, Vmes = %d, PWM = %d\r", (int)commandSpeed, (int)currentSpeed, pulsewidth_propulsion); + sprintf(terminalOutput, "Vcons = %d m/s, Vmes = %d mm/s, PWM = %d\n\r", (int)commandSpeed, (int)(currentSpeed*1000), pulsewidth_propulsion); serial_port.write(terminalOutput, strlen(terminalOutput)); tTerminalWriting.reset(); } @@ -128,4 +114,7 @@ //Command car's speed pulsewidth_propulsion = PID(commandSpeed - currentSpeed, CONTROL_RATE); propulsion.pulsewidth_us(pulsewidth_propulsion); + + //Open loop (for coef) + } \ No newline at end of file