AC.motion

July 24, 2006

Basic Stamp, this is Java calling

Finally: communications between the Basic Stamp and the Java program. I started out with getting the Basic Stamp code into shape. I had copied together bits and pieces from the test programs I wrote last year. Now, the code got sifted through, and the sonar and the compass send decent messages via the DEBUG command.

Looks good in the BS editor debug window. Then I wrote a Java test class that receives messages from the Basic Stamp. First, I got bits and pieces because the messages weren't properly separated. Now each messages is followed by a newline, and input is read line by line.

Works! Next step: Receiving messages from the Java program. I played with the SERIN command, and it took about 2-3 hours before I understood the following: The Basic Stamp has no input buffer. It the Java program sends data while the stamp is not listening, the data simply is lost. Solution: The stamp signals "ready", and after a short wait the Java program send its data.

This worked from the debug window and the Windows standard terminal program, but not with the Java programm. I got rare and sporadic results when I put all three read operations into a single SERIN command (command code, argument, and value), but this did not really work.

Further: I glued the luster terminals to the board that holds the power controllers - let's see if the glue (not epoxy) works.

0 Comments:

Post a Comment

<< Home