Changing Variables while Program is Running
3dogpottery
Posts: 78
in Propeller 1
I am making a "ballbot" using a propeller. I am at the stage where I need to fine tune the PID. It would be ideal if I could fine tune the PID while the propeller program is running. I have been trying to use HyperTerminal to do this, but I don't seem to have as clue as to what I am doing. If someone could give me a few suggestions, I would appreciate it.
Comments
I usually do this by sending a header byte or two (like 0x55, 0x44) so the Prop knows that what follows is legitimate data, then send a byte for what parameter you're changing, followed by the 4 bytes for the value itself. It's pretty simple to set up, and C# on the PC side works really well for simple stuff like that.
If you want to do it on the Prop and a terminal, and you want to keep it simple, do something like this: Interpret digits 1 through 9 as P strength values from 100 to 900, and interpret 'QWERTYUIOP' characters as strengths for another parameter.
That way, you don't have to provide a full proper interface, but you can noodle the numbers really easily.
You could also try something like using 'Q' and 'A' to increment and decrement one parameter, 'W' and 'S' to increment/decrement another one, and so on. Every time you change a value, have the Prop display the name and current setting of it so you can keep track.
Jason
Something like this:
... and so on. I can't remember if the function is called rx or rxCheck, but it's one of those. It returns -1 if no character was present, or a valid byte value of the character if there was one.