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!
NXT-G program: Sync point between PC and Robot
-
- Posts: 358
- Joined: 01 Oct 2010, 06:37
- Location: Denmark
- Contact:
Re: NXT-G program: Sync point between PC and Robot
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.
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/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
Re: NXT-G program: Sync point between PC and Robot
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.
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
Thanks for the ideas, guys!
Who is online
Users browsing this forum: Semrush [Bot] and 1 guest