Home→Forums→MonoBrick Communication Library→PC Send Bluetooth
- This topic has 5 replies, 2 voices, and was last updated 11 years, 9 months ago by
Anders Søborg.
-
AuthorPosts
-
February 17, 2014 at 10:31 #3970

seb helibolesParticipantHello,
I want to send a message with the pc to the NXT with your function void Bluetooth::send(unsigned char *buffer, unsigned int num_bytes) and I would like more details to use this for sending a message.
Sorry for my english, I’m french.February 18, 2014 at 19:25 #3973
Anders SøborgKeymasterHi this is for the C++ library…
Ok could you please post some code of what you are trying to do
Anders
February 20, 2014 at 15:35 #3977
seb helibolesParticipantI use this code
#include <cstdlib> #include <iostream> #include <string> #include <conio.h> #include "nxt.h" using namespace std; Bluetooth *blue = new Bluetooth(); int port ,erreur=0; int main() { try{ cout << "Tentative de connexion" << endl; cout << "Selectionner le port" <<endl; while(erreur==0){ try{ scanf("%d",&port); blue->connect(port); cout << "Connexion reussi" << endl; erreur=1; } catch (Nxt_exception& e){ printf("- Port %d Erreur \n",port); } } } catch (Nxt_exception& e){ //some error occurred - print it out cout << e.what() << endl; cout << "error code: " << e.error_code() << endl; cout << "error type: " << e.error_type() << endl; cout << e.who() << endl; return 0; } unsigned int b=2; unsigned char un[]={'0','a'}; blue->send(&un[0],b); }February 20, 2014 at 21:09 #3978
Anders SøborgKeymasterEverything looks ok – but the command that you are sending does not make sense to the NXT firmware. Also be sure to close the connection when you are done. If you go to the documentation you can see the source code for some of the things that I implemented. You can find the documentation here
Anders
February 21, 2014 at 18:02 #3983
seb helibolesParticipantI do not understand what I have to write in the table to be understood by the nxt.
I have to use a procedure?-
This reply was modified 11 years, 9 months ago by
seb heliboles.
February 24, 2014 at 20:11 #3994
Anders SøborgKeymaster -
This reply was modified 11 years, 9 months ago by
-
AuthorPosts
You must be logged in to reply to this topic.

Follow