12 unsigned char str[12];
17 if(!strcmp(str,
"AB360 "))
19 print(
"=== Success! ===\r\r");
20 print(
"The last calibration worked. You are ready to go!\r\r");
23 else if( !strcmp(str,
"AB360cstart") || !strcmp(str,
"ActivityBot"))
25 print(
"=== Whoops!!! ===\r\r");
26 print(
"You might need to re-calibrate.\r\r");
28 print(
"=== What's the problem? === \r\r");
30 if(!strcmp(str,
"AB360cstart"))
32 print(
"Calibration started but did not complete.\r\r");
33 print(
" Did you wait for the calibration maneuvers to\r");
34 print(
" complete AND for the yellow P26 P27 lights\r");
35 print(
" to turn off before setting PWR back to 0?\r\r");
37 else if(!strcmp(str,
"ActivityBot"))
39 print(
"There is calibration data for a different kind of ActivityBot\r");
40 print(
"(the kind with external encoders) in the EEPROM.\r\r");
41 print(
" Do you have an ActivityBot 360?\r");
42 print(
" If yes, find and follow the instructions for\r");
43 print(
" calibrating your ActivityBot 360.\r\r");
46 print(
"=== What do I do now? ===\r\r");
47 print(
" - Go to the calibration instructions for your ActivityBot 360,\r");
48 print(
" and follow them carefully.\r");
49 print(
" - Re-run the calibration program.\r");
50 print(
" - Run the calibration results program.\r");
52 else if(!strncmp(str,
"AB360", 5))
54 sscan(&str[6],
"%d", &errorVal);
56 print(
"=== Uh oh!!! ===\r\r");
61 (errorVal == AB360_ERROR_CABLE_SWAP)
63 errorVal == AB360_ERROR_NO_ENC_SIG_BOTH
65 (errorVal == AB360_ERROR_NO_ENC_SIG_LEFT)
67 (errorVal == AB360_ERROR_NO_ENC_SIG_RIGHT)
70 if(errorVal == AB360_ERROR_NO_ENC_SIG_BOTH)
72 print(
"You might need to do something different with \r");
73 print(
"the PWR switch during calibration.\r\r");
76 print(
"You might need to fix a servo connection mistake.\r\r");
80 (errorVal == AB360_ERROR_BATTERIES_TOO_LOW)
82 (errorVal == AB360_ERROR_BATTERIES_TOO_HIGH)
85 print(
"You might need to fix a power supply problem.\r\r");
90 print(
"Something isn't right here...\r\r");
95 print(
"=== What's the problem? === \r\r");
111 case AB360_ERROR_CABLE_SWAP:
112 print(
"One pair of cables was swapped.\r\r");
113 print(
" Did your robot drive forward briefly?\r");
114 print(
" The yellow signal wires on P14 and P15 may have been swapped.\r\r");
115 print(
" Did your robot drive backward briefly?\r");
116 print(
" The 3-wire cables on P12 and P13 may have been swapped.\r\r");
118 case AB360_ERROR_NO_ENC_SIG_BOTH:
119 print(
"The servos did not respond when calibration started.\r\r");
120 print(
" Did you follow these steps during the calibration?\r");
121 print(
" - Click Load & Run (Save code to EEPROM) button.\r");
122 print(
" - Set PWR switch to 0 as soon as it's done loading.\r");
123 print(
" - Set the ActivityBot on the floor.\r");
124 print(
" - Set PWR switch to 2.\r\r");
125 print(
" Are the yellow wires firmly plugged onto the\r");
126 print(
" P14 and P15 pins?\r\r");
127 print(
" Is the jumper tab to the left of the P12/P13 servo ports\r");
128 print(
" set to VIN?\r\r");
129 print(
" Is each white wire on the 3-wire servo cable closest to\r");
130 print(
" the P12 P13 labels near the outside edge of the Activity\r");
131 print(
" Board WX?\r\r");
132 print(
" Are the P12, P13, P14 and P15 sockets by the white\r");
133 print(
" breadboard empty?\r\r");
135 case AB360_ERROR_NO_ENC_SIG_LEFT:
136 print(
"The left servo is not responding.\r\r");
137 print(
" Is the left servo's yellow feedback signal wire firmly plugged\r");
138 print(
" onto the P14 pin?\r\r");
139 print(
" Is the white wire on the left servo's 3-wire cable closest to the");
140 print(
" P12 label?\r\r");
142 case AB360_ERROR_NO_ENC_SIG_RIGHT:
143 print(
"The right servo is not responding.\r\r");
144 print(
" Is the right servo's yellow feedback signal wire firmly plugged\r");
145 print(
" onto the P15 pin?\r\r");
146 print(
" Is the white wire on the 3-wire cable closest to the P13 label?\r\r");
148 case AB360_ERROR_NO_MOTION_LEFT:
149 print(
"Something is preventing the left wheel from turning.\r\r");
151 case AB360_ERROR_NO_MOTION_RIGHT:
152 print(
"Something is preventing the right wheel from turning.\r\r");
154 case AB360_ERROR_NO_MOTION_BOTH:
155 print(
"Something is preventing the both wheels from turning.\r\r");
157 case AB360_ERROR_BATTERIES_TOO_LOW:
158 print(
"Weak power supply.\r\r");
159 print(
" Is the shut jumper to the left of the P12 port set to VIN?\r\r");
160 print(
" Are your batteries new or freshly recharged?\r\r");
162 case AB360_ERROR_BATTERIES_TOO_HIGH:
163 print(
"Servos turning faster than normal.\r\r");
164 print(
" Are you using 5 AA batteries?\r\r");
165 print(
" Did you place the ActivityBot on its wheels on the floor to\r");
166 print(
" execute its calibration maneuvers?\r\r");
168 case AB360_ERROR_POSSIBLE_AB_NOT_360:
169 print(
"Encoder signals could be non-360 ActivityBot.\r\r");
170 print(
" Does your ActivityBot have external encoders attached between the\r");
171 print(
" wheels and chassis? Are there four 3-wire cables attached to\r");
172 print(
" P12, P13, P14, and P15?\r\r");
174 case AB360_ERROR_XFER_OUT_OF_RANGE:
176 print(
"Something isn't right, but this diagnostic cannot\r");
177 print(
"identify it.\r\r");
180 print(
"=== What do I do now? ===\r\r");
183 (errorVal == AB360_ERROR_CABLE_SWAP)
185 (errorVal == AB360_ERROR_NO_ENC_SIG_BOTH)
187 (errorVal == AB360_ERROR_NO_ENC_SIG_LEFT)
189 (errorVal == AB360_ERROR_NO_ENC_SIG_RIGHT)
191 (errorVal == AB360_ERROR_BATTERIES_TOO_LOW)
193 (errorVal == AB360_ERROR_BATTERIES_TOO_HIGH)
196 print(
" - Check your assembly instructions.\r");
197 print(
" - Double check your wiring connections.\r");
201 (errorVal == AB360_ERROR_NO_MOTION_LEFT)
203 (errorVal == AB360_ERROR_NO_MOTION_RIGHT)
205 (errorVal == AB360_ERROR_NO_MOTION_BOTH)
208 print(
" - Check for anything that's preventing.\r");
209 print(
" the wheel from turning, and remove any.\r");
210 print(
" obstructions.\r");
214 (errorVal == AB360_ERROR_POSSIBLE_AB_NOT_360)
217 print(
" - Check the web/book instructions to find out if you have.\r");
218 print(
" an ActivityBot, or an ActivityBot 360. Then, follow the.\r");
219 print(
" calibration instructions for your version of ActivityBot.\r");
222 print(
" - Re-run the calibration program.\r");
223 print(
" - If you get another uh-oh, re-run this\r");
224 print(
" calibration results program.\r");
227 (errorVal == AB360_ERROR_NO_MOTION_LEFT)
229 (errorVal == AB360_ERROR_NO_MOTION_RIGHT)
231 (errorVal == AB360_ERROR_NO_MOTION_BOTH)
233 (errorVal == AB360_ERROR_XFER_OUT_OF_RANGE)
237 (errorVal < AB360_ERROR_XFER_OUT_OF_RANGE)
240 print(
" - If you need more help, try Parallax Technical\r");
241 print(
" Support:\r");
242 print(
" support@parallax.com\r");
243 print(
" 888-512-1024\r\r");
248 print(
"Calibration records not found. Default\r");
249 print(
"calibration values will be used.\r\r");
250 print(
"For better performance, follow instructions\r");
251 print(
"for calibrating your ActivityBot360.\r");