Is it possible to connect two bricks using a cable (connecting port 4 to port 4) , and then have both programs run by only pressing one button? I want the sensors attached to one brick affect the motors that are attached to the other brick, if possible. I am only using NXT 2.1 programming if that helps. Thanks !
What you're describing is not (directly) possible, but you DO have some alternative options:
The standard solution is to use Bluetooth. Two NXTs can communicate with Bluetooth using the Lego software.
- Pair the NXTs using the on-brick menus.
- Write programs for both NXT 1 and NXT 2:
- At the start of the program, NXT 1 initiates a Bluetooth connection to NXT 2.
- NXT 1 sends a message when it wants NXT 2 to do something; NXT 2 responds when it's finished.
- Start both programs manually (in this setup, NXT 2 has to start first so it'll be ready when NXT1 connects).
If something less complex is acceptable, you can communicate using light sensors. Attach 2 light sensors facing directly into each other. One NXT can talk to the other by flashing the light on the sensor.
If you're open to alternative languages, LeJOS (Java for Mindstorms) gets you a lot closer to your goal. Through Bluetooth, NXT 1 can remotely start a program on NXT 2, or even access the motors and sensors. You can even communicate over high-speed RS485 by directly wiring two port 4's together, just like you said.
There used to be a 3rd-party NXT-G block for sending data over RS485. With it you could write programs for NXT 1 and NXT 2 like I described above, but with a direct wire between port 4's instead of Bluetooth. It would probably have lower latency than Bluetooth, but it's still not as direct as you would like.