125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// stops the pid line following
void
slave_stop_pid()
{
serial_send_blocking(
"\xBC"
, 1);
}
// clear the slave LCD
void
slave_clear()
{
serial_send_blocking(
"\xB7"
,1);
}
// print to the slave LCD
void
slave_print(
char
*string)
{
serial_send_blocking(
"\xB8"
, 1);
char
length =
strlen
(string);
serial_send_blocking(&length, 1);
// send the string length
serial_send_blocking(string, length);
}
// go to coordinates x,y on the slave LCD
void
slave_lcd_goto_xy(
char
x,
char
y)
{
serial_send_blocking(
"\xB9"
,1);
serial_send_blocking(&x,1);
serial_send_blocking(&y,1);
}
int
main()
{
char
buffer[20];
// load the bar graph
load_custom_characters();
// configure serial clock for 115.2 kbaud
serial_set_baud_rate(115200);
// wait for the device to show up
while
(1)
{
clear();
print(
"Master"
);
delay_ms(100);
serial_send(
"\x81"
,1);
if
(serial_receive_blocking(buffer, 6, 50))
continue
;
clear();
print(
"Connect"
);
lcd_goto_xy(0,1);
buffer[6] = 0;
print(buffer);
// clear the slave's LCD and display "Connect" and "OK" on two lines
// Put OK in the center to test x-y positioning
slave_clear();
slave_print(
"Connect"
);
slave_lcd_goto_xy(3,1);
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
10. Expansion Information
Page 80 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...