Can't control nxt remotely after restarting it

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 11
Joined: Tue Nov 29, 2011 8:27 am

Can't control nxt remotely after restarting it

Postby Mariam » Sat Jan 21, 2012 11:34 am


I am trying to contorl the nxt remotely via Bluetooth from my java application.
I made a simple application that move motor A forward for a second then stops it

Code: Select all

import lejos.nxt.Motor;
private void jBtnNXTForward(java.awt.event.ActionEvent evt) {
        try {
        } catch (InterruptedException ex) {

The problem is If I restarted the nxt and pressed the forwatd button again. It doesn't work, The first press doesn't work and doesn't show any error , starting from the second press I get the error message

Failed to write; [10053] An established connection was aborted by the software in your host machine.

I tried to use a connect function before Motor.A.forward(); command, to connect if the nxt isn't connected, but it didn't help. It shows that the nxt is already connected

The connect function:

Code: Select all

public static void Connect () throws Exception {
            NXTCommand singleton = NXTCommand.getSingleton();
    if (!singleton.isOpen()) {
        try {
            NXTComm nxtComm =;
            if (nxtComm == null)
                System.out.println("nxtcomm is null");
                throw new IOException();
         } catch (IOException ioe)
            System.err.println("Failed to open connection to the NXT");
        System.err.println("The connection is already open....");   

I have to close my java application and open it again to start working. Is there something missing in my code ?
Thanks in advance

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 6 guests