I can get the example working with USBReceive on the NXT and USBSend on the PC.
The way it works is the the USBSend (pc) sends some data and then waits for the response from the NXT. ie ithe pc is effectively polling the NXT and I have been able to setup a buffer so data is requested by the PC and then sent by the NXT and that works although not entirely reliably.
Now, what I really want is for the NXT to be able to send data whenever it wants, without waiting first for data from the PC. But if say I comment out the read and replace it with a sleep and just try to send data every 500ms.
Code: Select all
//USBReceive inner loop
//int b = dIn.readInt();
Then if I modify the USBSend on the pc to just receive then it all seems to freeze up and I get no data being sent by the NXT or received by the PC just a bunch of time-out's it seems.
It really appears like I need to receive data in the NXT before I can send data and while I can work around this by polling for data I really would like to send it asynchronously from the NXT.
Has anyone seen something like this before? suggestions?