hhhhhhhhhhhhAt this point, I have gotten the slave NXT to send the value of its ultra sonic and light sensors to the master NXT so that the master can read the values in real time as though they're connected to that NXT itself. In addition, I have been trying to make there be three certain commands that the master can directly send to the slave NXT and control its motor. With this, the master NXT will be dependent on the slave NXT only for these things, and I will be able to program the rest of this robot's functions on the master NXT, that way, I will not have to constantly switch between the two programs when programming my robot.
hhhhhhhhhhhhUnfortunately, I have had trouble getting these motor commands to sucessfully send to the slave NXT over RS485. I have proven that the problem is with the master NXT, because I temporarily deleted the part of the master NXT's program which receives the sensor values, and sure enough, I was able to control the slave NXT's motor A. It is my belief that the receiving part of the RS485 command was taking proirity over the sending part. However, I have tried putting the sending commands into a separate thread from the receiving, and that didn't work. (I find it strange that the slave program, though it uses a thread for sending, and a thread for receiving, it has no problems. This could partially be due to the fact that it's not as big of a program or something else.)
hhhhhhhhhhhhFurthermore, I tried making a logic variable, setting it to false whenever the send commands were supposed to go, and setting the variable true whenever the send commands are not going, and only allowing the receive commands to execute when the logic variable is true. I've tried many other techniques that have failed, so please, if you are going to help me, then don't just present a theory without testing it. Please modify the program(s) included, and only post back if you've tested and gotten it to work.
hhhhhhhhhhhhSo, in a nutshell, I want the master NXT to be able to read from the slave NXT's light sensor in port 3, and ultra sonic sensor in port 1 as I can right now in the program, and also send motor commands to the slave NXT simultaneously. There are a few extra blocks that you will need to have installed to be able to edit these programs. Don't worry, I'll include them in the attachment incase you don't already have them installed. Plus, my programs have annotations in them which I think will help you out a lot in helping me
