Connect two NXTS

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Connect two NXTS

Postby Lego-3D-drucker » Sun Dec 09, 2012 12:53 pm

Hello everybody,

I'm trying for a long time to bind my two NXTS in order that one of this could command all devices of the other (Sensor and Motors...)
It would be like as if a had only one NXT.
I think that it's possible, isn't it ?

Thank you for you help!
Lego-3D-drucker
New User
 
Posts: 8
Joined: Sun Dec 09, 2012 12:47 pm

Re: Connect two NXTS

Postby TechnoX » Tue Dec 11, 2012 7:12 pm

Yes, you can communicate between your two NXTs by bluetooth or RS-485.

Either by LCP or by having a program running on both NXTs.

Try to read: http://lejos.sourceforge.net/nxt/nxj/tu ... ations.htm
TechnoX
Novice
 
Posts: 52
Joined: Tue May 03, 2011 5:57 pm
Location: Sweden

Re: Connect two NXTS

Postby Lego-3D-drucker » Fri Dec 14, 2012 8:54 pm

Hello, thank you for your answer, i ll look at that tomorrow with my mate :)
Nice evening
Lego-3D-drucker
New User
 
Posts: 8
Joined: Sun Dec 09, 2012 12:47 pm

Re: Connect two NXTS

Postby Lego-3D-drucker » Fri Dec 14, 2012 8:56 pm

Re hello,
We had alredy try to understand the link you send, but there is so many mixed information that we are lost.
Is what we need a stream ?
Lego-3D-drucker
New User
 
Posts: 8
Joined: Sun Dec 09, 2012 12:47 pm

Re: Connect two NXTS

Postby TechnoX » Fri Dec 14, 2012 9:27 pm

Depends on what you're trying to do...
You can connect two NXTs in different ways!
TechnoX
Novice
 
Posts: 52
Joined: Tue May 03, 2011 5:57 pm
Location: Sweden

Re: Connect two NXTS

Postby Lego-3D-drucker » Sat Dec 15, 2012 11:36 am

We are doing a 3d printer with lego.
Till now we have been programming with the basic software of nxt.
So we had a nct who did calculs (depending of many variables) and then just send the result to the other nxt.
Now we are programming with java.
And we had expected that it was possible to connect to nxt together so that it would be like ONE nxt.
I mean that you could just progran on the first one, and if we want to use a motor conected to the second one just write something likt this "nxt2.p1.motor.forward();"
So the code of the second nxt would just be "make connection with nxt1 and let s him give you order"
You know what i mean ?

Ps: our blog
http://lego-3d-drucker.blogspot.ch/

Thanks for helping
Lego-3D-drucker
New User
 
Posts: 8
Joined: Sun Dec 09, 2012 12:47 pm

Re: Connect two NXTS

Postby TechnoX » Sat Dec 15, 2012 3:52 pm

Okay, then Lego Communication Protocol is the right thing for you!

The chapter "Controlling a remote NXT" in the link I gave you: http://lejos.sourceforge.net/nxt/nxj/tu ... ions.htm#9

You can access all your analog NXT sensors from the remote NXT.
But keep in mind that the motors are not regulated so if you need exact movements maybe it is better to write a slave program?
TechnoX
Novice
 
Posts: 52
Joined: Tue May 03, 2011 5:57 pm
Location: Sweden

Re: Connect two NXTS

Postby Lego-3D-drucker » Sat Dec 15, 2012 4:05 pm

Hi,

First of all thank for your quick answer.
When you say "the motors are not regulated ", you meen that it s not possible to make a "Motor.X. rotation of 542°" ?
Here the code we have done till now.
Do you know why it doesnt work ?

Code: Select all
package src;



import javax.bluetooth.RemoteDevice;

import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.comm.BTConnection;
import lejos.nxt.comm.Bluetooth;
import lejos.nxt.remote.RemoteNXT;

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

         Button.waitForAnyPress();
         LCD.drawString("Connecting...", 0, 0);
         RemoteDevice bt = Bluetooth.getKnownDevice("Cavin");
         BTConnection btc = Bluetooth.connect(bt);
         RemoteNXT nxt = new RemoteNXT("Cavin", btc);
         LCD.clear();
         LCD.drawString("Connected", 0, 0);
         LCD.drawString("Press any button", 0, 2);
         
         Button.waitForAnyPress();
         LCD.clear();
         nxt.C.setSpeed(50);
         nxt.C.backward();
         Button.waitForAnyPress();
         nxt.C.stop();

      }
   }


Thanks you
Lego-3D-drucker
New User
 
Posts: 8
Joined: Sun Dec 09, 2012 12:47 pm


Return to NXJ Projects

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

more stuff