Basic DC motor control test, rpm feedback by simple impulse signal, PID speed control.
Dependencies: FastPWM mbed FastIO MODSERIAL
Diff: main.cpp
- Revision:
- 6:cc38171e6a4b
- Parent:
- 5:ec4d6e435822
- Child:
- 7:1aba48efb1c3
diff -r ec4d6e435822 -r cc38171e6a4b main.cpp --- a/main.cpp Tue Mar 27 16:11:44 2018 +0000 +++ b/main.cpp Tue Mar 27 21:24:35 2018 +0000 @@ -24,7 +24,7 @@ //------------------------------------ MODSERIAL pcLink(SERIAL_TX, SERIAL_RX); -static const us_timestamp_t periodImpSens = 250000; // 250 msec +static const us_timestamp_t periodImpSens = 125000; // 125 msec static const us_timestamp_t periodLEDBlink = 100000; // 100 msec static const us_timestamp_t periodPWMWrite = 5000000; // 5 sec @@ -92,7 +92,7 @@ uiImpSens = uiImpSensTemp; uiImpSensTemp = 0U; - pcLink.printf("IMP: %u imp.\r", uiImpSens); + pcLink.printf("IMP: %u imp. \r", uiImpSens); } void tskLEDBlink(void) @@ -106,12 +106,12 @@ if (1.0 < dPwmDuty) { - dPwmDuty = 0.1; + dPwmDuty = 0.0; } mypwm.write(dPwmDuty); - pcLink.printf("\r\nPWM: %.2f %%\r\n", mypwm.read() * 100); + pcLink.printf("\r\nPWM: %.2f %% \r\n", mypwm.read() * 100); } void tskBackground(void)