* Note: Open the serial port with settings 9600-N-8-1.
The Cricket program I used is:
loop [send sensora send sensorb]
I then have a C program that reads pairs of values from the serial port, and moves a pixmap around in a window, using the two values it read to position the pixmap. By hooking two light sensors to the sensora and sensorb inputs on the cricket, the pixmap can be moved by modulating the light source on the vertical and horizontal sensors. If a byte gets dropped, then the sensors will trade function.
It took a little while to figure out the serial port read, write and open routines. I studied to "Serial Programming Guide for POSIX Operating Systems" by Michael R. Sweet which describes some of the calls, and gives sample code.
It also took a little while to find a graphics library that is simple enough to use for plotting to the screen, so that I could get it running in a week. Here I used the GGI libraries. They seem pretty small and flexible. After a day or two of messing around with the install, and a day or two playing with modifying the examples I had something running.
The code can be downloaded here. It works, but it may not be pretty! Do a make serialtoy to compile, and then a ./serialtoy to run.
Note: It may be necessary to do a export GGI_DISPLAY="palemu:X" before running serialtoy, depending on how your GGI environment is installed. This was necessary for me on the install I did under Redhat 7.3.