Page 1 of 1

Remote control of motors using C/C++

Posted: 28 Jan 2011, 14:37
by ubertron
Hi,

I'm wondering if the NXT motors can be controlled using a c/c++ program in real time. I have a project that contains several other c++ files which basically layout a maze for the robot to follow. I would like to read in the encoder values so that the numbers can be used in my other source files to calculate where in the maze the robot currently is. Then depending on the location in the maze i want to be able to send motor controls back to the robot. (all done through USB).

I'm basically setting up a maze for my robot to go through, only its all virtual. If this can not be done using the NXT controller brick any recommendations of how to do it with a different controller? i know adrinuo and legos popular but i dont know if adrinuo can be controlled this way either.


Any ideas?
Thanks

Re: Remote control of motors using C/C++

Posted: 28 Jan 2011, 15:04
by mightor
Please use sensible post subjects, rather than "HELP". I've changed it on your post.

- Xander

Re: Remote control of motors using C/C++

Posted: 29 Jan 2011, 00:08
by lizard381
Lego has provided their API, and using their API it is possible to write code in C++ that will control your robot from your pc...but I'm not sure about having that code on the NXT brick. I know I've seen projects, like NXT OSEK (http://lejos-osek.sourceforge.net/whatislejososek.htm) that should allow you to have the code on your NXT, but I haven't tried this personally. Perhaps someone in the forums has and can report back with their experience? The only downside is that it's Windows only, no Mac support, no official Linux support.

Kami

Re: Remote control of motors using C/C++

Posted: 29 Jan 2011, 13:40
by h-g-t
You can command the motors and sensors through the Bricx Center (http://bricxcc.sourceforge.net/) so possibly you could incorporate code from that into your own program.

OnBrick (http://www.pspwp.pwp.blueyonder.co.uk/s ... index.html) also allows remote operation of the NXT from a computer or pda so that code might be useful as well.

Googling 'remote operation of lego nxt' got a few hits as well.

Re: Remote control of motors using C/C++

Posted: 30 Jan 2011, 01:35
by dsjove
LEGO's driver has a C++ interface that lets you control the robot in realtime. It is available in Windows and on the Mac (not certain about Linux).
LEGO.com, Products, Mindstorms, Support, Files, Software Dev kits.