BlitzMax & Lego Mindstorms NXT

BlitzMax Forums/BlitzMax Programming/BlitzMax & Lego Mindstorms NXT

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

An update and a partial success:

I launched a small icommand Java program to initialize the serial port and play a tone. Instead of quitting the application, I let it wait for a key press:

import icommand.platform.nxt.*;
import java.io.File;
import icommand.nxtcomm.*;

	public class Melody {
		
		public static void main(String [] args) throws Exception {

			NXTCommand.playTone( 4000, 600);

System.in.read();

			NXTCommand.close();
		}
}


Now, I let this BlitzMax program run while the Java app is still waiting for a keypress:

NXTWrite:TStream = WriteStream( "/dev/tty.NXT_1" )

If Not NXTWrite
	Print "Failed to open write stream."
	End
End If

NXTRead:TStream = ReadStream( "/dev/tty.NXT_1" )


If Not NXTRead
	Print "Failed to open read stream."
	End
End If

WriteShort( NXTWrite, $06 )
WriteByte( NXTWrite, $00 )
WriteByte( NXTWrite, $03 )
WriteShort( NXTWrite, 4000 )
WriteShort( NXTWrite, 600 )

FlushStream( NXTWrite )

Print "Now:" + StreamSize( NXTRead )


For n:Int = 0 To 6
	Print ReadByte( NXTRead )
Next

CloseStream( NXTWrite )
CloseStream( NXTRead )



And guess what? It -DOES- play the same sound on the brick! :-))))

So the problem -is- the initialization of the BlueTooth serial port.

Well, I cannot do more tonight, the thing has to wait until the weekend, I'm afraid. But at least there is some progress. :)