This is confusing.
I don't see any BLE libraries and calls in your .ino, only classic BlueTooth:
ino code
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the CH9141 TX to the Arduino RX on pin 2.
// Connect the CH9141 RX to the Arduino TX on pin 3 through 1k resistor and to ground through 2k resistor (voltage divider).
#define LEDpin 8
byte read;
unsigned long currentTime;
unsigned long lastTime;
unsigned long interval = 1000; // milliseconds
int value = 12;
void setup() {
Serial.begin(9600);
Serial.println("Waiting for incomming data from CH9141BLE2U");
BTserial.begin(9600);
pinMode(LEDpin, OUTPUT);
digitalWrite(LEDpin, 0);
delay(500);
}
void loop() {
currentTime = millis();
if (currentTime - lastTime >= interval) {
Serial.println(value);
BTserial.println(value);
value++;
lastTime = currentTime;
}
// Keep reading from CH9141 and send to Arduino Serial Monitor and toggle the led
if (BTserial.available() > 0) {
read = BTserial.read();
Serial.println(read);
digitalWrite(LEDpin, read);
}
}
Resolution to confusion:
The .ino only talks to the BLE chip, as documented at
Read through the doc for the UUIDs your app will need, as well as any AT commands the ino may need to send to set up the BLE chip.
Just in case: