Hello,
I have a project for school which consists in the creation of a hit captor for boxer (sac de frappe in french). To do this, i have to connect an Arduino nano 33 ble Sense with the Bluetooth. The idea is to transfer measurements of the accelerometer to a smartphone with an application by using bluetooth (maybe made with MIT app Inventor ??).
I also want to add a fonction in the code that can calculate power of the boxer's hit from the measurements of acceleration (accelaration --) force ---) power) to finally create a graphic showing to the boxer the power of his hits on the punching bag (with simple visual values ) .
But i didn't manage to connect my arduino to my smarthphone with the classic bluetooth button of my smartphone. I followed a tuto to connect it and I only succeeded in connecting the arduino with an application called "nFr connect" but I can't do anything except read "hello world".
Do you know if "nFr connect" is capable of display a graph of something like this in order to have simple and intuitive informations for a boxer ?
The code (for bluetooth nFr connect) in question is here : (it's just an example because my final goal is to do this but with the accelerometer)
#include <ArduinoBLE.h>
static const char* greeting = "Hello World!";
BLEService greetingService("180C"); // User defined service
BLEStringCharacteristic greetingCharacteristic("2A56", // standard 16-bit characteristic UUID
BLERead, 13); // remote clients will only be able to read this
void setup() {
Serial.begin(9600); // initialize serial communication
while (!Serial);
pinMode(LED_BUILTIN, OUTPUT); // initialize the built-in LED pin
if (!BLE.begin()) { // initialize BLE
Serial.println("starting BLE failed!");
while (1);
}
BLE.setLocalName("Sac de frappe"); // Set name for connection
BLE.setAdvertisedService(greetingService); // Advertise service
greetingService.addCharacteristic(greetingCharacteristic); // Add characteristic to service
BLE.addService(greetingService); // Add service
greetingCharacteristic.setValue(greeting); // Set greeting string
BLE.advertise(); // Start advertising
Serial.print("Peripheral device MAC: ");
Serial.println(BLE.address());
Serial.println("Waiting for connections...");
}
void loop() {
BLEDevice central = BLE.central(); // Wait for a BLE central to connect
// if a central is connected to the peripheral:
if (central) {
Serial.print("Connected to central MAC: ");
// print the central's BT address:
Serial.println(central.address());
// turn on the LED to indicate the connection:
digitalWrite(LED_BUILTIN, HIGH);
while (central.connected()){} // keep looping while connected
}
// when the central disconnects, turn off the LED:
digitalWrite(LED_BUILTIN, LOW);
Serial.print("Disconnected from central MAC: ");
Serial.println(central.address());
}
Thanks for your help (sorry for my english)