USB経由でコンピューターとやり取りするArduinoのようなデバイスがあり、Bluetooth経由でもアクセスできます。私のデバイスには TX/RX ピンが 1 つしかないため、特別なイベントの後に Bluetooth モジュールへの TX/RX 接続をアクティブにし、いくつかの値を読み取り、USB 接続を再度有効にしたいと考えています。
これは可能ですか?
シリアル入力は、この形式 !mod2 で提供されます。!mod は識別子で、2 は値です...
if (selection == 16) //activates bluetooth selection mode
{
digitalWrite(ledGreen, HIGH);
Serial.begin(9600); //start serial connection
while (Serial.find("!mod") == false)
{
delay(100);
}
short val = Serial.parseInt();
Serial.end(); //close the connection to bt module, re-enable usb