Bluetooth LE with Software Serial

I have an Arduino UNO R4 Wifi, but it has its embedded Bluetooth module of type LE (Low Energy), currently I have this code that receives a value 1 or 0 through an interface that I made in Python using PyQT6, and the serial release , the problem is that I can't connect my arduino to my computer via bluetooth because it doesn't detect it and when it detects it, it tells me "Error trying to connect, try again", this is my code.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11);

void setup() {
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  Serial.println("Arduino connected");
  mySerial.begin(38400);
}

void loop() {
  if (mySerial.available() > 0) {
    String command = mySerial.readStringUntil('\n');
    if (command == "0") {
      digitalWrite(13, LOW);
      Serial.println("LED OFF");
    } else if (command == "1") {
      digitalWrite(13, HIGH);
      Serial.println("LED ON");
    }

    Serial.print("> ");
    Serial.println(command);
  }

  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}

Bluetooth and BLE are incompatible services. Both ends of the communication link must be of one type or the other, not split.

There are libraries and procedures for using BLE that I don't know anything about, but what I do know is that you aren't using any of them. Also, while BLE is called to run at 38400, has it been configured to do so? Even it it has been, doing so under software serial is not such a good idea.

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