ESP 32 BLE Data sending

Hi I am developing a program for the use of ESP 32 BLE.

if ( gyroZ_int > 65535) {
      TOF_1_Characteristic->setValue((uint16_t*)&gyroZ_int, 2); // 1 = 1 byte = 8 bits
      TOF_1_Characteristic->notify();
}

gyroZ_int is an integer variable. I am able to use uint8_t but I require a 16 bit resolution. How do i go about doing this?

if you look at the definition of setValue() if takes a pointer to the start of your data and the data length. it does not care what the data represent, it will just know that you have n bytes of relevant data at that memory address

if you have int16_t gyroZ_int; then use ....->setValue((uint8_t*) &gyroZ_int, sizeof(int16_t)); // sizeof int16_t is 2 but more readable the expression &gyroZ_int means "the address of gyroZ_int", which we then cast into a pointer to bytes with (uint8_t*) as this is what the function expects