Hi again, not sure if any of you are in today or not… But happy Easter!
I believe I have a version of the Botboarduino SSC-32 PS2 CHR-3 robot working OK. There are some quirks and some more testing, that can/should be done. Not sure if you have a setup there you can try it on? As part of this I removed most of the debug code as well as the streaming class.
Took me longer to get it working as when I moved the SSC-32 over to the old CHR-3, the left side got hooked up to the right side servos… So Up was down… 
Jim and others, up till now, for the most part the code pretty much follows along with the Basic program. That is we have more or less the same variable names… So if you can read one, you should not be that difficult to read through the C++ code and figure out what is going on. There are some hidden gotchas in the conversion. Things like on the BAP all math functions are done in 32 bit, whereas with C it is done differently depending on the size of the variables that are used. That is if you add a byte to a byte and it exceeds 256 it was probably still truncated to a byte value. So in C to get around this you will see places where we cast a variable to a bigger size to tell the compiler…
But soon, I will make a pass through the code and try to make it more maintainable and provide better scoping of data… Also would like to introduce a few more objects to the code. I already defined a class for ServoDriver, where I have two different implementations. I would also like to define a class for ControlInput, which the main code would call. As part of this, would like to reduce the number of globals. Not sure yet if they will simply be member variables of the classes or might create some class state objects… we will see…
But for now I will start simple and see where it goes. May also delay this slightly to do some more testing and to see which other robot classes that there is no code to run on the BotBoardDuino…
Kurt
Saturday Morning update: I have done some more hacking on the PS2x library, which I uploaded here. If you get a chance try it out and see if it helps. What I changed was, I merged in my Pic32xxx code, which had separate inline methods for things like clearing the clock bit, likewise for setting the clock bit. I did this earlier on the Pic as they had separate registers for this and it made them atomic… While doing this I also sped them up on the Arduino. Why, because his old code would at startup time get the bitmask for a pin, then convert it to a pin number and then the set/clr functions would have to convert the pin number back to a mask. Now I simply use the mask… Also to try to minimize the time interrupts are disabled, I moved the atomic code into each of these methods. Probably made the code slightly larger, but I probably removed that much code by the shifts… that were needed before.
Note: I have two versions of the library in the zip file… The new one has the standard name.
PS2X_lib.zip (21 KB)
BotBoardDuino_CHR3_PS2-120406b.zip (27.2 KB)