Hello, i have a problem, i have just bough a bluetooth module, HC-05, i was able to connect it to arduino and i have paired it to my pc, but i want to pilot it by the pc with c++, i need to send by c++ a serial data with bluetooth, how can i do? thank you ![]()
arduino code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
void setup()
{
 pinMode(2, OUTPUT);
 mySerial.begin(9600); // setto la comunicazione
 delay(1000);
}
void loop()
{
 while (mySerial.available())
 {
   int state= mySerial.read(); // "state" could be the value that i send by c++
   switch(state)
   {
    case '1': // if recieve 1
    {
 digitalWrite(2, HIGH); // turn on rele
      mySerial.println("Relè 1 ON");
     break;
    }
    case '0': // if recieve 0
    {
 digitalWrite(2, LOW); // turn off relè
     mySerial.println("Relè 1 OFF");
     break;
    } Â
          Â
   }  Â
 }
}
