Files
J1B4-Fitbot/code/arduino/Position-tracking/test/test.ino
SebasKoedam 39f3d4bb1d feat: Add Arduino code for position tracking
The code changes include adding a new Arduino sketch for position tracking. The sketch is located at `code/arduino/Position-tracking/Position-tracking.ino`. Additionally, a new class `PositionSensor` is added with its corresponding header and implementation files. This class handles the position sensor functionality and includes methods for initialization and measurement.

The commit message suggests that the changes are a new feature addition related to position tracking in the Arduino code.
2024-05-21 12:55:14 +02:00

40 lines
1.4 KiB
C++

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// Define the BLE service and characteristic UUIDs
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
void setup() {
// Initialize the BLE environment
BLEDevice::init("ESP32-S3");
// Create a BLE server
BLEServer *pServer = BLEDevice::createServer();
// Create a BLE service
BLEService *pService = pServer->createService(SERVICE_UUID);
// Create a BLE characteristic
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE
);
// Set the initial value of the characteristic
pCharacteristic->setValue("Hello, World!");
// Start the service
pService->start();
// Start advertising the BLE service
BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->start();
}
void loop() {
// Nothing to do here for this example
}