I 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);
}
Follow