3pi controlled with Stamp2

What would be the shortest program to control a 3pi robot with a Stamp2. It would be great to also pull in the sensor information. Setting the speed to each wheel could be done with one serial line.


You should be able to send commands to the 3pi serial slave program. You can find out more about this in the Pololu 3pi Robot User’s Guide in section 10.a. Serial slave program:


From there you would need to use the PBasic command SEROUT to send commands to the 3pi and SERIN to receive data back. An (untested) example program to command the 3pi to move motor 1 forward at full speed would be:

' {$STAMP BS2}
' {$PBASIC 2.5}
SO PIN 1 ' serial output
FC PIN 0 ' flow control pin

SEROUT SO\FC, 16468, [0xC1,127] ' send the command 0xC1=motor 1 forward, 127=speed range between 0 and 127


Thank you!