| PS2 Robot Control: Establishing Communication.
For Mini Atom Bot Board/BotBoard II. BASIC Atom IDE v2.2.1.1/5.3.1.0 04/17/2008 By James Frye. Establishing a fast and reliable connection between a PS2 style controller and a Basic Atom 28 or BASIC Atom Pro 28 processor with a Mini Atom Bot Board or Bot Board II. (The Basic Stamp 2 processor cannot properly read the left vertical joystick.) |
![]() Too cool! |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Step 1. Plug in the PS2 cable as shown. Be
extremely careful to observe polarity on the power connector. Black is ground and yellow is +5vdc. The black wire is actually the red/shield
with black heat shrink covering them. Figure 1-1 shows what each of the PS2 cable wires are.
|
![]() Figure 1-2. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Step 2. Copy & paste the program from the bottom of the page into the editor. There are two sections that need to be tailored to your setup. At the top of the program, in the "Bot Board Selection" section, you select either Mini-Atom Bot Board, or the Bot Board II. Remove the semicolons in front of the four lines that match your board, and add semicolons in front of the four lines that do NOT match your board. At the bottom of the program, in the "Basic Micro IDE Terminal" section you select the IDE you are using. You will need to do this twice - once under "sending carriage return", and once under "sending all the data". Remove the semicolons from the 1 line in both places to match your IDE, and add semicolons in front of the lines that do NOT match your IDE. The program uses the Bot Board II, Basic Atom 28 and the 5.3.0.0 editor as the default. If this is your setup, no changes need to be made. Once all changes are made, program the Atom. After the program is running, click on the Terminal1 tab (item #28 in Figures 2-1 and 2-2 below). Change the Baud Rate to 57.6kbs (item #1). Then click Connect (item #6). If all is well, you should see numbers similar to the ones shown. Note that the program automatically puts the controller in Analog mode. Refer to Table 2-1 for a description of the bytes returned by the PS2 controller. Note that items 8 and 9 are the Digital representation of button presses. Refer to Table 2-2 for a Bit representation of button presses. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Table 2-2 and 2-3 illustrate which bits go low when the corresponding button is
pressed. The arrow buttons are on what is commonly called the "D-Pad," which is the button pad on the left. L3 and R3 are the little-known Left and Right joystick buttons; trigger these by pressing down on the joysticks. R1, R2, L1, and L2 are the "shoulder buttons," that is, they are located on the controller's "shoulders." |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The two analog joysticks on a Sony-brand controller will not neatly return
to a middle value of 128. The following value ranges are what the joysticks have been known to return to. If you need better accuracy with the
analog joysticks, we recommend our Lynxmotion wireless RC-01 controller. We have also had good results with Madcatz or Pelican-brand
controllers. They always returned to the middle value of 128.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Step 3. Code by Laurent Gay. As a demonstration of the internal vibrating motors, the
following program turns on the motors with button presses. For example, the smaller motor is turned on by the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||