Page 1 of 1

NXT-G program: Sync point between PC and Robot

Posted: 31 Oct 2011, 23:42
by mkaushik
Hi all,

I'm teaching some kids how to program NXT 2.0 robots using NXT-G software. The aim is to make the robots "dance" to a tune, by programming them to move in sync to an mp3 played on a PC.
As you might have guessed, the problem is syncing the starting of the mp3 on the PC to the starting of the program loaded on the robot, which is being done manually right now and is thus prone to errors.
Can you folks suggest a way to do this? I presume it involves Bluetooth in some way.

Thanks in advance!

Re: NXT-G program: Sync point between PC and Robot

Posted: 01 Nov 2011, 06:41
by spillerrec
It will require some programming on the PC. Your PC program will communicate with the NXT and music player, telling them to start at the same time.

If you are using something like C# or Visual Basic I guess there might be a Media Player component inbuilt somewhere, it would probably be easier just to use that and let your own application play the music (instead of communicating with another external application on your PC).
Then you will just have it send out a BT signal from this program when you want it to start, with the NXT turned on and waiting for this specific signal.

Making a PC program that can communicate with your NXT might be tricky though, depending on which language you want to use. There are several libraries for communicating with NXTs out there, but most of them only works with specific languages. Once you have set it up and working it shouldn't cause much trouble though.

Re: NXT-G program: Sync point between PC and Robot

Posted: 01 Nov 2011, 14:34
by ronmcrae
A low-tech option might be to have the color sensor on each robot. Set to light sensor mode it could detect the room light going on. So if you start all the programs with the room light off they could reset a timer when the room light comes on.

As I say, low-tech, but probably a lot simpler than B/T which would have at least some latency between messages to each 'bot.

Re: NXT-G program: Sync point between PC and Robot

Posted: 01 Nov 2011, 16:36
by mkaushik
Thanks for the ideas, guys!