Bluetooth; any NXT programmer’s bane.  In order to get the simple yet somehow frustrating mechanic to function properly, one simply needs to connect two NXT bricks, enter a passcode on them both, then connect.  Easy, right? Not so much.

Here are the problems we’ve encountered so far:

  • You should be able to connect 3 NXTs at once to a 4th.  However, upon connecting the second NXT, the first’s connection is overwritten.
  • There is not explicit way for connected bricks to communicate in the same program.  Instead, using different programs, the main NXT needs to send a “letter” of sorts, which the other NXT will read and react to.  As of yet, our attempts to receive letters have been unsuccessful.
  • Each NXT has 4 output channels (0-3) but only 3 input channels (1-3).  It boggles the mind.

Fun fact: the NXT Bluetooth search “loading bar” is actually just more and more question marks.  The irony inherent in this feature is almost too much to bear.

Sweet sweet progress????

After much painstaking searching and connecting, we have finally discovered the secret to connecting multiple NXTs.  Instead of using one brick as a hub for the others to connect to, instead we need to send out separate connections using our bowl-bot.  This way, the strange overwriting bug can’t happen.

Getting the Bluetooth NXTs to talk to one another is proving more and more difficult.  In an effort to track down the problem, we had each NXT display the value of the “mail” sent to it by the bowl-bot, and instead of the expected value of 7 we had the mysterious value of -1, which we can only assume is the default value of Bluetooth mailboxes.

As another update, we finally managed to coerce the stations into reacting to the bowl-bot.  For a while we couldn’t send the mail, but at last they work together.  Our only problem now is a pretty big one; upon arriving at the third station, the last NXT brick freezes up completely and won’t respond to button presses, and needs to have its battery unplugged in order to restart.  Hooray.

Sometime later…

Still no luck with the third station.  We attempted to switch NXT bricks but to no avail, so the problem must be somewhere in the code or with the Bluetooth.  Our guess is it’s in the code.  Since the only difference between this program and the other (working) ones is the use of a couple “for” loops, we think it’s possible that’s where the problem lies. We’re going to try replacing them with “while” loops.

At last, success!  The “for” loops were indeed the culprits, and after replacing them with while loops the programs ran successfully.  All that needs to be done for the third station is a small delay so the bowl-bot can pull under the cherry dispenser, and we should be ready for testing.

Conclusions for Day 7:

  • Bluetooth is very frustrating to set up, but once working it isn’t too much of a problem.
  • Bluetooth + For loops = Crashes, crashes everywhere.
  • Running 4 NXTs at once chews through batteries.

Goals for Day 8:

  • Finish coding for the stations, and do a few more test runs.
  • Adjust bowl-bot; doesn’t quite fit through station 2 at the moment.
  • Make a sundae!  Sans ice cream, unfortunately.