tbi fiat com controle feedforward PID
Dependencies: mbed reScale TextLCD
Diff: main.cpp
- Revision:
- 3:9d22aa32b223
- Parent:
- 2:3c69c0772709
- Child:
- 4:9da4a46f38bc
diff -r 3c69c0772709 -r 9d22aa32b223 main.cpp --- a/main.cpp Wed Apr 25 12:06:39 2018 +0000 +++ b/main.cpp Wed Apr 25 12:10:09 2018 +0000 @@ -4,6 +4,7 @@ InterruptIn movida(D1); DigitalOut ign(LED1); +PwmOut boost(LED2); Timer tbase; @@ -11,7 +12,7 @@ Serial pc(USBTX, USBRX); // tx, rx -unsigned long int t_motora, t_movida; +unsigned long int t_motora, t_movida, delta; void tracao() { @@ -44,7 +45,10 @@ while(1) { - + + delta = t_motora - t_movida; + boost.pulsewidth_ms(delta); + if(t_movida < t_motora) { ign=0;