#include <WiFi.h>
#include <BluetoothSerial.h>
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
void loop2( void * parameter )
{
for (;;) {
SerialBT.begin("XXXXXX");
}
}
void setup() {
Serial.begin(115200);
xTaskCreatePinnedToCore(loop2, "buttonCheck", 1000, NULL, 1, &Task1, 0);
}
void loop() {
}
This is my reproducible code, I am using two loops in my project but Bluetooth not starting in my second loop and loop stuck at that point but if I write
SerialBT.begin("XXXXXX");
inside main loop then it's working fine. Why it's happening? I don't want to write my code in main loop so please guide me.
That's why it's only iterate one time in the loop and I tried by printing a text before and after begin then it's just printing text that written before the begin statement, and statement just after the begin not printing means loop stuck at the beign() part.