hhhhhhhhhhhhHi there, I am right now making a robot which uses two NXT's, six sensors, and four motors; however, I have run into a problem with programming it which is halting it's production. So, what I currently have is two NXT-G programs. One, for the master NXT, and the other for the slave NXT. It's purpose is to be an autonomus vehicle which (I hope) will be very inteligent due partially to its large number of sensors.
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 (and maybe elongate your attention span). Please leave all code in NXT-G, I don't know any other programming languages for the NXT, and I don't have enough time to learn one well enough to finish this program and meet the deadline, so please keep it NXT-G. So, below are the programs:
RS485 Send and Receive Simultaneously. (Please help!)
-
- Posts: 252
- Joined: 22 Oct 2010, 20:05
- Location: The United States of America
- Contact:
RS485 Send and Receive Simultaneously. (Please help!)
- Attachments
-
- Vehicle.zip
- So, here are the master and slave programs along with a myblock, and all third-pary blocks used in the programs just incase you don't have them installed.
- (1.14 MiB) Downloaded 195 times
-Hayden
-
- Posts: 252
- Joined: 22 Oct 2010, 20:05
- Location: The United States of America
- Contact:
Re: RS485 Send and Receive Simultaneously. (Please help!)
Well, some help would've been appriciated. I see that the attachment has been downloaded four times. Thank you, anyone who downloaded the program and tried to help me out, but it looks like I'm on my own here.
That is now negated. If anyone would like to post something on this topic, like your story of trying to help me or something else that 's somewhat related to this, then you may. Or, if you did not notice this topic before when it was near the top of the list, then you may try now to fix it. I thought I might just give this topic a little bump cause it's near the bottom of the list with no replies.haydenstudios wrote: 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.
-Hayden
Re: RS485 Send and Receive Simultaneously. (Please help!)
I wish I could help you but you are using NXT-G and very very few people are trying to use RS485 with NXT-G, to the best of my knowledge, anyway.
John Hansen
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 252
- Joined: 22 Oct 2010, 20:05
- Location: The United States of America
- Contact:
Re: RS485 Send and Receive Simultaneously. (Please help!)
Yep, I was kindof afriad of that. That's why, after this project is done, I'm going to purchase your book and start learning NXC. Thanks for your sympathy anyway.afanofosc wrote:I wish I could help you but you are using NXT-G and very very few people are trying to use RS485 with NXT-G, to the best of my knowledge, anyway.
John Hansen
-Hayden
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests