NXT-G program: Sync point between PC and Robot

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
mkaushik
Posts: 2
Joined: 31 Oct 2011, 23:37

NXT-G program: Sync point between PC and Robot

Post 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!
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

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

Post 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.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
ronmcrae
Posts: 33
Joined: 28 Sep 2010, 14:56

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

Post 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.
mkaushik
Posts: 2
Joined: 31 Oct 2011, 23:37

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

Post by mkaushik »

Thanks for the ideas, guys!
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests