I made a fall classification model that detects two labels: ADL or FALL, download the binary which gives me edge impulse and it works correctly.
enter image description here
I want the label that comes out to be sent to an app via Bluetooth, that’s why I made the following sketch in Aruino IDE
#include "NDP.h"
#include "Nicla_System.h"
#include <ArduinoBLE.h>
// Alert Service
BLEService alertService("b6a9c10a-b242-4397-9afe-2688a86c8b5c"); // Bluetooth® Low Energy LED Service
BLEUnsignedCharCharacteristic alertCharacteristic("d86af06b-228d-4300-8f9f-ca30db6ee3ac", BLERead | BLENotify);
void blesend(char* label) {
Serial.print("Label received: ");
Serial.println(label);
if (strcmp(label, "NN0:ADL") == 0) {
alertCharacteristic.writeValue(1);
Serial.println("ADL Detected!!!");
NDP.noInterrupts();
nicla::leds.begin();
nicla::leds.setColor(green);
delay(200);
nicla::leds.end();
NDP.interrupts();
} else if (strcmp(label, "NN0:FALL") == 0) {
alertCharacteristic.writeValue(2);
Serial.println("FALL Detected!!!");
NDP.noInterrupts();
nicla::leds.begin();
nicla::leds.setColor(green);
delay(200);
nicla::leds.end();
NDP.interrupts();
} else {
Serial.println("No match found.");
}
}
void ledGreenOn() {
nicla::leds.begin();
nicla::leds.setColor(green);
delay(200);
nicla::leds.setColor(off);
nicla::leds.end();
}
void ledRedBlink() {
while (1) {
nicla::leds.begin();
nicla::leds.setColor(red);
delay(200);
nicla::leds.setColor(off);
delay(200);
nicla::leds.end();
}
}
void ledBlueBlink() {
for (int i = 0; i <= 2; i++) {
nicla::leds.begin();
nicla::leds.setColor(blue);
delay(200);
nicla::leds.setColor(off);
delay(200);
nicla
First I uploaded the binary generated by edge impulse and then the sketch I made with arduino ide and the result is the following:
Loading synpackages
packages loaded
dsp firmware version: 19.2.0
package version: Model generated by Edge Impulse
pbi version: 3.2.3-0
num of labels: 2
labels: NN0:ADL, NN0:FALL
total deployed neural networks: 1
BLE advertising started
Waiting for central device...
Waiting for central device...
Waiting for central device...
Waiting for central device...
Connected to central device.
Sent test message.
In the app I have I only get 0 , no 1 (ADL) or 2 (FALL), any idea how I could fix this?. Thanks in advance
Alan Barco is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.