2014-02-18 4 views
1

자습서에 나와있는 것처럼 직렬 모니터를 사용하여 직렬 포트를 통해 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! 
} 

답변

0

예, "$$$"은 3 자만 보내십시오. 나는 또한 조금 붙어 있었다. 나는 또한 메이트 응답 "CMD"를 읽는 것이 필요하다는 것을 발견했다. 이것은 게시 된 스케치에 나와 있지 않다.

+3

좀 더 자세히 설명해 주시겠습니까? 나는 이것이 완전한 답이라고 확신하지 못한다. –

1

: 당신이 어떤 CR/LF없이 $$$ 를 보낼 수있는 명령 모드로 들어갑니다. 명령 모드를 입력 한 후에는 명령을 보내야하며 모든 명령 은 CR LF에 따라을 따라야합니다. 그렇지 않으면 모듈이 응답하지 않습니다. 도움이 되길 바랍니다.

관련 문제