Trying to use voice recognition to send Bluetooth commands. on a nano33 rp2040 board with a non trial license for Cybron Voice recognition. Bluetooth works by itself and voice recognition works by itself but when combined Bluetooth stops scanning. When run no peripherals are found.
If I comment out:
// settup VR
//if (g_oDSpotterSDKHL.Init(DSPOTTER_LICENSE, sizeof(DSPOTTER_LICENSE), DSPOTTER_MODEL,VRCallback) != DSpotterSDKHL::Success)
return;
And adjust the state machine in loop to not do VR in the below code I get a constant list of mac addresses and a match for my device
#include <Adafruit_NeoPixel.h>
#include <ArduinoBLE.h>
#include <DSpotterSDK_MakerHL.h>
#include <LED_Control.h>
#include "Model_xxxxxxxxxxxx.h" // x'd out model / key
#define DSPOTTER_MODEL g_lpdwModel
static DSpotterSDKHL g_oDSpotterSDKHL;
BLEDevice MyBLEDevice;
BLECharacteristic MyCharecteristic;
#include "CybLicense_xxxxxxxxxx.h" // x'd out model / key
void setup()
{
Serial.begin(9600);
while (!Serial);
// begin initialization
if (!BLE.begin())
{
Serial.println("starting Bluetooth® Low Energy module failed!");
while (1);
}
DSpotterSDKHL::ShowDebugInfo(true);
// settup VR
if (g_oDSpotterSDKHL.Init(DSPOTTER_LICENSE, sizeof(DSPOTTER_LICENSE), DSPOTTER_MODEL,VRCallback) != DSpotterSDKHL::Success)
return;
Serial.println("Bluetooth® Low Energy Controller - start scan");
State = 0; // Start at the beginning
// start scanning for peripherals
BLE.scan();
} // end settup
void loop()
{
switch(State)
{
case 0: // look for device in BLE Scans. if not not found repeat
{
SearchForBLEDevice();
if( FoundMyDevice) State = 1;
break;
}
case 1: // Found device so send initial command to MyDevice
{
for(int i=0;i<16;i++) Buffer[i] = Anim[i];
Buffer[OffsetAnim] = 0x0A;
EncryptPacket();
if(MyCharecteristic.canWrite())MyCharecteristic.writeValue(Cipher,16);
State = 2;
break;
}
case 2:
{
// Do VR
g_oDSpotterSDKHL.DoVR();
break;
}
}
} // end loop
bool SearchForMask()
{
BLEDevice peripheral = BLE.available();
// check if a peripheral has been discovered
if (peripheral) // never returns true
{
// discovered a peripheral, print out address, local name, and advertised service
Serial.print("Found ");
Serial.print(peripheral.address());
Serial.print(" '");
Serial.print(peripheral.localName());
Serial.print("' ");
Serial.print(peripheral.advertisedServiceUuid());
Serial.println();
// see if peripheral is a MYDevice
if (peripheral.localName() == "XXXXXXXXXX") // My Device
{
MyDevice = peripheral;
// stop scanning
BLE.stopScan();
return explorePeripheral(peripheral); // ... get characteristics etc...
//return true;
} else return false;
}
Any help would be most appreciated...