I have a motor control project that has been Basic Stamp for a long time. I keep upgrading the type of STAMP I use for more speed, etc. I can use SX or anything version I need.
What I need to do here is use a command speed (0 to 255) and use it to control a motor that drives my project. In this case it is a Train.
I get feedback that is MPH (again in the form of 0 - 255).
I am looking for way to compare the command speed ("peddle" 0-255), look at the actual speed ("mph" 0-255)
and generate a new speed command (throttle - 0-255).
I will need a couple of variables I can adjust to close the loop but this is a routine I am unfamiliar with.
I would appreciate any help I can get. I would like to use my normal speed control to get myself to a particular speed then turn on the sub-routine so that the STAMP program will then hold the speed.
Anyone care to chime in here?