Snapshot Posted July 13, 2012 Posted July 13, 2012 Has anyone used BT comms between NXT bricks? I'm looking at it for my NXT-controlled PF train layout as I'm getting to the stage where I need either very long cables or multiplexors that won't take long cables. The code neatly breaks into two sections so using two NXTs is looking like a good solution. I just need to pass one logic value from one NXT to the other but can't work out from the block description whether I need to send the false value before sending another true. I hope this makes sense.... Jonathan Quote
DLuders Posted July 13, 2012 Posted July 13, 2012 You could probably control your entire train layout with this: I got this e-mail from Dexter Industries yesterday: "Control a LEGO Robot with an iPad or iPhone" Have you ever wanted to control your robot with your iPhone, iPad, or MacBook? Now you can! The new websocket example software allows a user to dynamically control the robot from a webpage from a browser on a laptop, computer, smart-phone (Android and iPhone), or tablet device (Android and iPad). •Control your LEGO MINDSTORMS with an iPhone or iPad •Robot Control Over WIFI for LEGO MINDSTORMS Quote
Burf2000 Posted July 13, 2012 Posted July 13, 2012 I have used Bluetooth between NXT's using robotC if that helps! Quote
DLuders Posted July 14, 2012 Posted July 14, 2012 (edited) Here is Dexter Industries' that demonstrates "Controlling a LEGO MINDSTORMS NXT with the iPad. Have you ever wanted to control your LEGO MINDSTORMS NXT robot with your iPhone, iPad, or MacBook? Now you can! The new websocket example software allows a user to dynamically control the robot from a webpage from a browser on a laptop, computer, smart-phone (Android and iPhone), or tablet device (Android and iPad). See more at: http://dexterindustries.com/blog/2012/07/12/control-your-lego-mindstorms-with-an-iphone-or-ipad ." Edited July 14, 2012 by DLuders Quote
Snapshot Posted July 14, 2012 Author Posted July 14, 2012 (edited) Here is Dexter Industries' that demonstrates "Controlling a LEGO MINDSTORMS NXT with the iPad. Have you ever wanted to control your LEGO MINDSTORMS NXT robot with your iPhone, iPad, or MacBook? Sorry, that's totally not what I'm doing. The NXT is stationary and controlling the trains via PF infra-red and doesn't need controlling itself. The whole point of what I'm doing is that the layout runs completely autonomously. I have used Bluetooth between NXT's using robotC if that helps! Probably does, Simon, as it's really just the protocol I'm trying to understand. As I said, I need to pass a logic value in one direction, to let the other NXT know a train has arrived at a station. If you do something like that in robotC would you need to pass the reset of the flag or would the receiving end just see that it was set when it got the next message passed to it? Edited July 14, 2012 by Snapshot Quote
DLuders Posted July 14, 2012 Posted July 14, 2012 @ Snapshot: Have you seen the HiTechnic NXT IRLink Sensor? With it, you can "Control LEGO R/C trains and other motorized LEGO sets with the HiTechnic IRLink Sensor for the Mindstorms NXT. The IRLink uses Infrared signals to communicate with trains, Power Functions Motor controller and the Mindstorms RCX . Control the speed and direction of up to three LEGO R/C trains (7897 and 7898) and other sets including the new Technic Motorized Bulldozer (8275) and the Monster Dino (4958). The IRLink enables NXT programs to read values from RCX sensors and control motors connected to the RCX." Quote
Snapshot Posted July 24, 2012 Author Posted July 24, 2012 (edited) Apologies for the late reply - been away for a bit. I'm already using the IRLink to control the trains and have been for over a year, albeit with an IR amplifier built by a friend as the IRLink's range is pathetic. The problem is that the layout and number of trains has grown such that I'm running into the limits of the number of sensors per NXT and the limits on cable length between sensor and NXT. I'd like to use Mindsensors' High Precision Distance sensors (if I can afford the six I need!) but I can only attach three plus an IRLink to each NXT. Mindsensors' sensor mux isn't powered so reduces the available cable length and, obviously, Mindsensors' sensors won't work with HiTechnic's powered mux. So the solution is to use two NXTs, one for each half of the layout and use Bluetooth to pass the single piece of info needed between them. I have been using home-made 'touch' sensors using reed switches that detect the train motor passing but they're a pain to make and mean permanently damaging two 2x4 plates, a 9V cable and a piece of RC track. I've made four but really don't want to make another six. I'm looking at light sensors at the moment as they're fairly cheap and I've seen Burf using one successfully on a train layout. The only hassle with them is that they need calibrating for ambient light before very use. Mindsensors distance sensors would be best but they're $70 each once shipping to the UK and taxes are added. This is still $10 cheaper than buying them from the only UK seller. There are added problems due to every PF motor being slightly different so stopping in a slightly different place but that's a story for another time..... Edited July 24, 2012 by Snapshot Quote
kieran Posted July 24, 2012 Posted July 24, 2012 Hi, if you are a coder and are happy to play about with NXC then this link could work I think http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___comm_module_functions_gab0fbb5bd16ba155fe3a7a3ac541b4952.html#gab0fbb5bd16ba155fe3a7a3ac541b4952 you will need to detect an event on the mater device, like train leaving station. this will then use the above call to place a message on a bluetooth connection lets assume its con #1 for now. the slave or remote unit could then make use of the following in a loop http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/group___comm_module_functions_ga2d0f44fe54ee34627d4423de5a08539e.html#ga2d0f44fe54ee34627d4423de5a08539e when it sees a message it will delete it and action the message, the nature of the 'message' is up to you, you can design your own protocol for that. Hope that helps, or at least gives you an idea how it may be done Quote
Snapshot Posted July 26, 2012 Author Posted July 26, 2012 Thanks, Keiron, that is very helpful in understanding how it works. My professional programming days ended 25 years ago so dabbling with NXT-G is about all I can manage now. I'll have to write a small test prog to make sure I have understood it correctly. Jonathan Quote
kieran Posted July 26, 2012 Posted July 26, 2012 No worries, hope it gets you to where you want to be. I only have one NXT so I cant test the coms or I would cut some code and post it up for you. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.