3
$\begingroup$

QT has native bluetooth support, but can it be used to communicate with the Lego NXT robot?

$\endgroup$
3
$\begingroup$

Sure it can. The NXT provides a bluetooth serial port, so you don't actually have to do anything with bluetooth in Qt. All of the Bluetooth stuff will be handled by your OS.

Instead, to communicate to the NXT from Qt, you will need to open the serial port for reading and writing, then send commands to the NXT over this connection. You can find out more about the available commands using the NXT Hardware Developer Kit.

$\endgroup$
  • $\begingroup$ You mean I don't have to do anything special with Qt to get it to work? Have you had any trouble getting Qt to talk with NXT? $\endgroup$ – Klik Nov 9 '14 at 5:11
  • $\begingroup$ I have never put the two together, but I have used the information in the NXT Hardware Developer Kit in other programing languages. I have also used Qt for other things, so I know that it has what is needed (i.e. a serial port class). You will have to implement the protocol your self though as I imagine it has not been done in Qt before. $\endgroup$ – David Lechner Nov 9 '14 at 22:45
  • $\begingroup$ Might I ask which software you've used? I'm finding it very difficult to use the Qt bluetooth classes. The documentation doesn't provide very many examples and the ones that there are (all three of them) don't seem to work. $\endgroup$ – Klik Nov 9 '14 at 23:45
  • $\begingroup$ I used C#. The Qt Bluetooth Chat example should get you started. The NXT is the server, so you just need to implement the client part. Of course, the NXT will only respond to messages formatted as specified in the NXT Hardware Developer kit that I linked. $\endgroup$ – David Lechner Nov 10 '14 at 0:52
  • $\begingroup$ For some reason I cannot get the bluetooth Qt examples to work. I'm running Windows 7. Even in the bluetooth scanner example, my device is not being located. $\endgroup$ – Klik Nov 10 '14 at 3:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.