ArduinoBLE writeValue(uint64_t)

Hi all,

I am trying to use the BLECharacteristic.writeValue() to send a 64bit data at once. For example:

uint64_t data;
BLECharacteristic.writeValue(data);

The compiler showed an error saying that the writeValue() is overloaded. The maximum is 32bit.

Is there a way to overcome this limit?

Note: I am not trying to split the 64bit data into 8 bytes. Since it won't work in my case. The Peripheral device I am trying to communicate receives 64 bit data at once and then executes an action. This means if one byte is received, it will treat the one byte data as a 64bit one and executes the wrong action or returns an error message.

For example:
I want to send 31 31 31 31 30 30 30 30
if sent by byte, the peripheral will treat them as 8 separate communications as:
31 0 0 0 0 0 0 0
31 0 0 0 0 0 0 0
31 0 0 0 0 0 0 0
31 0 0 0 0 0 0 0
30 0 0 0 0 0 0 0
30 0 0 0 0 0 0 0
30 0 0 0 0 0 0 0
30 0 0 0 0 0 0 0

Any help is appreciated.

Thanks,

The peripheral sounds very strange.

What happens if you send a byte array.

uint8_t myData[ ] = { 31, 31, 31, 31, 30, 30, 30, 30 }
.writeValue( myData, 8 );

Hi there,

Thank you for your response.

It will respond 8 times and treat them as 8 separate communications.

Do you have documentation on the peripheral? What is it normally communicating with that can send the 64 bit number in the way it requires?

Yes.

It receives a 64bit data as a command+value format. For example:

St140000 means: Set Time as 140000 ms
Si200000 means: Set Current as 200000 uA.

Upon receipt of the command, the peripheral will also send back acknowledgement:

Ai200000 measn: Acknowledge current set as 200000 uA.

It also respond to an enquiry:

For example,

Qi: means inquire current.
Ai200000: means acknowledge current 200000 uA.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.