PC side:
- Code: Select all
NXTConnector connector = new NXTConnector();
connector.connectTo("usb://NXT");
DataOutputStream output = new DataOutputStream(connector.getOutputStream());
Boolean black = true;
while (true)
{
try {
for (int x = 0; x < 100; x++)
{
for (int y = 0; y < 64; y++)
{
output.writeByte(x);
output.writeByte(y);
output.writeBoolean(black);
output.flush();
}
}
black = !black;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
NXT Side:
- Code: Select all
USBConnection connection = USB.waitForConnection();
DataInputStream input = connection.openDataInputStream();
while (true)
{
try {
LCD.setPixel(input.readByte(), input.readByte(), input.readBoolean() ? 1 : 0);
} catch (IOException e) {
return;
}
}
It's supposed to first set all pixels black, then all pixels white, then again all pixels black etc.
Ideally screen would be flickering. But everything is happening very slowly. Screen needs around 6 seconds to fully refresh (from left to right).
So there are 6400 pixels in display, each pixel needs 3 bytes (I know this could be done much more efficiently, but I feel it should still work much faster even with 3 bytes per pixel) and it needs around 6 seconds to update whole screen. So 6400 * 3 / 6 = 3200Bps.
Is that really maximum speed NXT can handle? It feels very slow for USB connection.
