Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Ouvrir un com bluetooth

1 réponse
Avatar
Soranne
Bonjour,
J'ai travaill=E9 pas mal en Csharp, et je commmuniquais souvent avec mon
Robot NXT pas Bluetooth. Voulant me mettre un peu au C++, j'ai d=E9cid=E9
d'essayer. Cependant avec mon ami google, je n'ai pas trouver comment
faire =E7a facilement...
Le code en C# =E9tait relativement simple, un petit exemple ;) :
SerialPort BluetoothConnection=3D new SerialPort();
BluetoothConnection.PortName =3D "COM7";
BluetoothConnection.Open();
BluetoothConnection.ReadTimeout =3D 1500;
BluetoothConnection.Write(Command, 0, Command.Length);
for(int i=3D0;i<ReplyLength ;i++)
{
textBox2.Text+=3DBluetoothConnection.ReadByte().ToString("X2");
}
BluetoothConnection.Close();

Existe il un moyen pour faire =E0 peu pr=E8s la m=EAme chose en C?

Ps: je suis d=E9butant...

1 réponse

Avatar
Christian ASTOR
On 17 oct, 23:20, Soranne wrote:
Bonjour,
J'ai travaillé pas mal en Csharp, et je commmuniquais souvent avec mon
Robot NXT pas Bluetooth. Voulant me mettre un peu au C++, j'ai décidé
d'essayer. Cependant avec mon ami google, je n'ai pas trouver comment
faire ça facilement...
Le code en C# était relativement simple, un petit exemple ;) :
SerialPort BluetoothConnection= new SerialPort();
BluetoothConnection.PortName = "COM7";
BluetoothConnection.Open();
BluetoothConnection.ReadTimeout = 1500;
BluetoothConnection.Write(Command, 0, Command.Length);
for(int i=0;i<ReplyLength ;i++)
{
textBox2.Text+=BluetoothConnection.ReadByte().ToString("X2");}
BluetoothConnection.Close();
Existe il un moyen pour faire à peu près la même chose en C?
Ps: je suis débutant...



Pour les communications Série, voir le vieil article :
http://msdn.microsoft.com/en-us/library/ms810467.aspx