HM-10 Bluetooth AT -ERROR

Hi Guys!

I'm trying to make a connection with my HM-10 Bluetooth in a way to send it signals. The connection can be built, it's available on different scans. But when I'm trying to run the following sketch

//  SerialIn_SerialOut_HM-10_01
//
//  Uses hardware serial to talk to the host computer and AltSoftSerial for communication with the bluetooth module
//
//  What ever is entered in the serial monitor is sent to the connected device
//  Anything received from the connected device is copied to the serial monitor
//  Does not send line endings to the HM-10
//
//  Pins
//  BT VCC to Arduino 5V out. 
//  BT GND to GND
//  Arduino D8 (SS RX) - BT TX no need voltage divider 
//  Arduino D9 (SS TX) - BT RX through a voltage divider (5v to 3.3v)
//
 
#include <AltSoftSerial.h>
AltSoftSerial BTserial; 
// https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
 
 
char c=' ';
boolean NL = true;
 
void setup() 
{
    Serial.begin(9600);
    Serial.print("Sketch:   ");   Serial.println(__FILE__);
    Serial.print("Uploaded: ");   Serial.println(__DATE__);
    Serial.println(" ");
 
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
}
 
void loop()
{
    // Read from the Bluetooth module and send to the Arduino Serial Monitor
    if (BTserial.available())
    {
        c = BTserial.read();
        Serial.write(c);
    }
 
 
    // Read from the Serial Monitor and send to the Bluetooth module
    if (Serial.available())
    {
        c = Serial.read();
 
        // do not send line end characters to the HM-10
        if (c!=10 & c!=13 ) 
        {  
             BTserial.write(c);
        }
 
        // Echo the user input to the main window. 
        // If there is a new line print the ">" character.
        if (NL) { Serial.print("\r\n>");  NL = false; }
        Serial.write(c);
        if (c==10) { NL = true; }
    }
}

and write AT in the monitor, I got

Sketch: /Users/imac5k/Documents/Arduino/BLE/BLE.ino
Uploaded: Feb 11 2022

BTserial started at 9600

>AT
βΈ®
ERROR

and I do not what is wrong.

VCC is 5V
RXD is pin 9
TXD is pin 8

(I use Arduino UNO)

As far as I understand is that my HM-10 is not fake (but not sure).

And when I get connection to it and try something send to it (the HM10.available() is always zero)...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.