p kj
/
LPC824-BalanceCar
Microduino
Fork of BalanceCar by
Revision 3:c6caae712d5d, committed 2016-06-07
- Comitter:
- lixianyu
- Date:
- Tue Jun 07 08:14:15 2016 +0000
- Parent:
- 2:99785a1007a4
- Commit message:
- ??????????work? ?????
Changed in this revision
Microduino_Stepper_PWM.cpp | Show annotated file Show diff for this revision Revisions of this file |
PID_v2.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 99785a1007a4 -r c6caae712d5d Microduino_Stepper_PWM.cpp --- a/Microduino_Stepper_PWM.cpp Tue Jun 07 05:26:03 2016 +0000 +++ b/Microduino_Stepper_PWM.cpp Tue Jun 07 08:14:15 2016 +0000 @@ -133,7 +133,7 @@ } else { gpio_write(&dirOUT, 1); - period = map(speed, -1200, -1, PERIOD_MIN, PERIOD_MAX); + period = map(speed, -1200, -1, PERIOD_MAX, PERIOD_MIN); pwmout_period_us(&pwmStep, period); } //stepperAllEnable();
diff -r 99785a1007a4 -r c6caae712d5d PID_v2.cpp --- a/PID_v2.cpp Tue Jun 07 05:26:03 2016 +0000 +++ b/PID_v2.cpp Tue Jun 07 08:14:15 2016 +0000 @@ -57,7 +57,8 @@ unsigned long now = g_Timer.read_us(); float dt = (now - lastTime)/1000.0; - if(dt>=SampleTime) { + //if(dt>=SampleTime) { + if (1) { /*Compute all the working error variables*/ float input = Input; float error = Setpoint - input;