Hi, thanks for the reply, I'm not sure if I can answer all those questions, I'm still trying to understand a lot of things, anyway here I go...
- Yes, Arduino should only send data (nothing to receive)
- Yes (I suppose that's the meaning of BLENotify)
- Not sure (details to follow)
I'll provide more details...
--- Arduino side:
global variables
// peripheral instance
BLEPeripheral blePeripheral;
// BLE custom service
BLEService footPedalService( ...some guid 1... );
static const int analogControllersCount = 2;
BLEUnsignedIntCharacteristic analogControllerCharacteristic[analogControllersCount] =
{
BLEUnsignedIntCharacteristic( ...some guid 2... , BLERead | BLENotify ),
BLEUnsignedIntCharacteristic( ...some guid 3... , BLERead | BLENotify)
};
in setup()
blePeripheral.setLocalName( ...a string... );
blePeripheral.setDeviceName( ...a string... );
// set the UUID for the service this peripheral advertises:
blePeripheral.setAdvertisedServiceUuid(footPedalService.uuid());
blePeripheral.setConnectionInterval(MIN_CONN_INTERVAL, MIN_CONN_INTERVAL);
// add service and characteristics
blePeripheral.addAttribute(footPedalService);
for (int i = 0; i < analogControllersCount; ++i)
blePeripheral.addAttribute(analogControllerCharacteristic[i]);
// initialize values
for (int i = 0; i < analogControllersCount; ++i)
analogControllerCharacteristic[i].setValue(0);
- then in loop is used like:
analogControllerCharacteristic[i].setValue( ... )
--- Central side (c# app running in windows 10)
A lot of code here, so I'll just put the device related stuff
I list potential devices using:
DeviceInformation.CreateWatcher(GattDeviceService.GetDeviceSelectorFromUuid( ...guid 1... ), new[] { "System.Devices.ContainerId" })
then something like:
var service = await GattDeviceService.FromIdAsync(value.Id));
var characteristic = service.GetCharacteristics( ...guid 2 / 3... )[0];
I don't see nothing related to interval settings in those classes, maybe some configuration in windows control panel?