我想发送一些命令到我的RN41蓝牙模块,通过串口连接到Arduino Leonardo,如本教程所示。但它没有回应。我可以连接到蓝牙模块和状态LED闪烁的权利。我试图将$$$发送到命令模式,眨眼率确实更改为10/秒,但模块没有响应。当我发送我认为这意味着连接是成功的,但我只是无法在串行监视器上看到任何东西。
正如教程所示,我将监视器的波特率设置为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!
}发布于 2014-08-26 23:32:57
是的,只发送3个字符,"$$$“。我也被困了一段时间。我还发现,阅读配偶的反应"CMD“是必要的,这是没有显示在已发表的草图。
发布于 2014-02-20 16:05:53
我陷入了非常简单的情况:要进入命令模式,您必须发送没有任何CR/LF的$$$ 。进入命令模式后,您必须发送命令,每个命令都必须由CR跟随。如果没有-模块将不会响应。希望这能有所帮助。
发布于 2018-08-20 14:48:19
我有一些全新的RN41VX模块。我通过模块(几乎与RN41 EVAL相同)将它们连接到计算机上。使用具有115 kbaud的终端,我发送$$$ (没有任何尾随字符作为0x0d)进入命令模式。LED开关到10赫兹眨眼-一切都很好。但终点站没有出现任何应答。
解决方案:我必须打开RTS信号,即使手动通知"Flow Control: none“
亲切问候沃尔克
https://stackoverflow.com/questions/21845183
复制相似问题