10 years, 9 months ago.

Two instances of PID controller causing problem

Hi there,

I'm trying to use the PID Controller library (http://mbed.org/cookbook/PID) to make a two wheeled buggy with mismatched go in a straight line using PWM. The code at the moment (not all shown) should create two instances of PID - one for the left and one for the right wheel. I can create one and it works ok, but if I add both it will stop the SevenSegmentDisplay module from working properly (it flashes once on pressing the reset button, then turns off). I don't get the red flashing error LEDs. Can anyone help?

Using an mbed lpc11u24

Buggy control

#include "mbed.h"
#include "SevenSegmentDisplay.h"
#include "PinDetect.h"
#include "PID.h"


#define KcL     0.9315       
#define KcR     0.6337      
#define TiL     0           
#define TiR     0          
#define Td      0.0         
#define RATE    0.01       

 /*Define pins for motors, brakes and sensor input*/ 

PID LeftControl(KcL, TiL, Td, RATE); 
PID RightControl(KcR, TiR, Td, RATE); 

SevenSegmentDisplay Display(INSTANT);

Is there anything else which uses alot of memory? That it could run out of memory? (Unlikely imo, but must be something).

Can you try to make a very simple program, either it works and it is related to something else, or it doesn't and you can publish it so others can look at it.

posted by Erik - 27 Feb 2014

I couldn't find anything that could be blocking it, and it was using something like 10% ram and 20% flash so wasn't running out of memory I don't think... I've since started again with a hello world and slowly got there. No idea what the original problem was and it may reappear with adding more of the old functionality back...

Thanks for responding.

posted by Elizabeth Lloyd 27 Feb 2014
Be the first to answer this question.