HM10 Bluetooth not replying

Hi,

I bought a HM10 bluetooth module and am trying to send AT commands to it using an Arduino Uno. I have tried many many codes to send and receive AT commands, but I never get a reply.

I have the code:

#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

delay(100);
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!
}

The HM10 led is flashing, so I know it is not connected to anything. And then I type AT in the serial monitor and click send, but I never get a reply of any kind. Any suggestions?

Meg93931: 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);

This looks like nonsense. I think the commands are in reverse order. Make sure Rx is connected to Tx and Tx to Rx

Those commands were meant to set up a software serial port from digital pins 2 and 3. Will this not work?

If I use the RX and TX ports on the Arduino, it won't let me load my program on the board. That is why I didn't use then.

I have tried reversing the TX and RX cables and still can't get a response.

Nick was suggesting that you take a closer look at the SoftwareSerial documentation. You create an instance thusly:

SoftwareSerial(rxPin, txPin, inverse_logic)

There are pin restrictions to consider and also, whether the module is 3.3V ONLY.

I was wrong about the command order but possibly right about the pin call. The order is important.

#include <SoftwareSerial.h>
const int Rx = 2;
const int Tx = 3;
SoftwareSerial bluetooth(Rx, Tx);

There is only one way to connect the serial wires.
Rx>Tx and Tx>Rx
I don’t use software serial but I think your problem lies there.