On the Handyboard
An example program that listens for the keys w,a,s,d and allows moving forward,
backward, or turning in place, can be found
here. To get the handyboard to listen to IC again after running the
program, you must hold down the stop button and at the same time press a
key on the connected computer.
- Load the handyboard serial libraries which can be found
- In your program, call disable_pcode_serial. The handyboard will no
longer be listening for Interactive C commands, it will instead listen
for a direct serial connection.
- Communicate with the host computer via serial_getchar and serial_putchar.
Both of these calls are blocking.
- Before your program finishes, be sure to call enable_pcode_serial,
so that the handyboard will again be listening to IC.
On the host computer
More complicated control is also possible. There is a more advanced serial
library here. You can also
use whatever program you want to communicate with your handyboard, or write
- After loading your program onto the handyboard, close IC. If IC is
open, no other program will be able to communicate with the handyboard
- Start up a serial connection program such as hyperterminal. Hyperterminal
is on all lab computers and will be available for the final demo.
- Open a serial connection on the same com port as IC uses. The connection
settings should be 9600 baud, no parity bit, 8 data bits and 1 stop
bit (N81) and either hardware or no flow control (you may have to experiment
with these settings) . Hyperterminal will prompt for these
settings when trying to open a new connection.
- Once the connection is open, send/receive commands to the handyboard.
In hyperterminal, pressing a key will send that key's value to the handyboard,
which can then decide what to do based on which key was pressed.