자습서에 나와있는 것처럼 직렬 모니터를 사용하여 직렬 포트를 통해 Arduino Leonardo에 연결하는 일부 RN41 Bluetooth 모듈에 명령을 보내려고합니다. 그러나 그것은 응답하지 않습니다. 블루투스 모듈에 연결할 수 있으며 상태 LED가 오른쪽으로 깜박입니다. 명령 모드로 변경하기 위해 $$$을 보내려고했지만 깜박임 속도는 10/초로 변경되지만 모듈은 아무런 반응을 보이지 않습니다. 그리고 '---'를 보내면 깜박임 속도가 정상으로 돌아옵니다. 연결이 성공했다는 것을 의미하지만 직렬 모니터에서 아무 것도 볼 수 없다고 생각합니다.Bluetooth RN41이 응답하지 않습니다
자습서에 표시된대로 모니터의 보 (baud)를 9600으로 설정했습니다. (https://learn.sparkfun.com/tutorials/using-the-bluesmirf/example-code-using-command-mode)
무엇이 잘못 될 수 있는지 알고 계십니까? 첨부 코드 : 나는 매우 간단한 케이스에 부착 된
/*
Example Bluetooth Serial Passthrough Sketch
by: Jim Lindblom
SparkFun Electronics
date: February 26, 2013
license: Public domain
This example sketch converts an RN-42 bluetooth module to
communicate at 9600 bps (from 115200), and passes any serial
data between Serial Monitor and bluetooth module.
*/
#include <SoftwareSerial.h>
int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps
bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps
bluetooth.print("$"); // Print three times individually
bluetooth.print("$");
bluetooth.print("$"); // Enter command mode
delay(100); // Short delay, wait for the Mate to send back CMD
bluetooth.println("U,9600,N"); // Temporarily Change the baudrate to 9600, no parity
// 115200 can be too fast at times for NewSoftSerial to relay the data reliably
bluetooth.begin(9600); // Start bluetooth serial at 9600
}
void loop()
{
if(bluetooth.available()) // If the bluetooth sent any characters
{
// Send any characters the bluetooth prints to the serial monitor
Serial.print((char)bluetooth.read());
}
if(Serial.available()) // If stuff was typed in the serial monitor
{
// Send any characters the Serial monitor prints to the bluetooth
bluetooth.print((char)Serial.read());
}
// and loop forever and ever!
}
좀 더 자세히 설명해 주시겠습니까? 나는 이것이 완전한 답이라고 확신하지 못한다. –