I have a BLE device that I’m trying to send a value to one of the characteristics. I’m not familiar with C++ but have experience in other languages (JS, Python) but nothing with extreme typing like C++ it seems like.
I have a global variable that comes from an number (template) (1-100)
error: could not convert 'current_head_tilt->esphome::globals::GlobalsComponent<int>::value()' from 'int' to 'std::vector<unsigned char>'
I eventually need to convert the number into a hex value and then pass it along in the value for the ble_write but am having difficulties getting passed this step.
Could someone provide any help? This is really the first time I’ve used the ble_client
The & is a “binary and” operator, the 0x000000ff acts as a “mask” to which bits you want to have, with ff beeing the last 8 bits. As the cpu cores used by ESP are little endian, these should be the value between 0-100.
If the compiler can not convert a single byte to an array/vector of bytes, you might need to do this by hand as well.