187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// function, and sends the value.
// Returns the last value computed if PID is running.
void
send_line_position()
{
int
message[1];
unsigned
int
tmp_sensors[5];
int
line_position;
if
(pid_enabled)
line_position = last_propo2000;
else
line_position = read_line(tmp_sensors, IR_EMITTERS_ON);
message[0] = line_position;
serial_send_blocking((
char
*)message, 2);
}
// Sends the trimpot value, 0-1023.
void
send_trimpot()
{
int
message[1];
message[0] = read_trimpot();
serial_send_blocking((
char
*)message, 2);
}
// Sends the battery voltage in millivolts
void
send_battery_millivolts()
{
int
message[1];
message[0] = read_battery_millivolts();
serial_send_blocking((
char
*)message, 2);
}
// Drives m1 forward.
void
m1_forward()
{
char
byte = read_next_byte();
if
(check_data_byte(byte))
return
;
set_m1_speed(byte == 127 ? 255 : byte*2);
}
// Drives m2 forward.
void
m2_forward()
{
char
byte = read_next_byte();
if
(check_data_byte(byte))
return
;
set_m2_speed(byte == 127 ? 255 : byte*2);
}
// Drives m1 backward.
void
m1_backward()
{
char
byte = read_next_byte();
if
(check_data_byte(byte))
return
;
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
10. Expansion Information
Page 71 of 85
Содержание 0J5840
Страница 24: ...Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 5 How Your 3pi Works Page 24 of 85...
Страница 67: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 67 of 85...
Страница 77: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 77 of 85...