Hi guys , i have a problem wit conversion ..
i need to send a message via esp_now function this is the function : i know the uint8_t is like a byte definition and is like an unsigned char
the declaration of the function is :
esp_now_send(const uint8_t *peer_addr, const uint8_t *data, size_t len);
void sendData(char * datos) {
uint8_t data =( uint8_t*)datos; // i try to cast char to uint8_t
for (int i = 0; i < SlaveCnt; i++) {
const uint8_t peer_addr = slaves.peer_addr;*
-
if (i == 0) { // print only for first slave*
-
esp_err_t result = esp_now_send(peer_addr, &data, sizeof(data)); // i want to send the data in uint8_t type*
-
Serial.print("Send Status: ");*
-
if (result == ESP_OK) {*
-
Serial.println("Success");*
-
}*
-
}*
}
i want to use :
sendData("hello");
i receive an error:
error: incompatible types in assignment of 'uint8_t* {aka unsigned char*}' to 'unsigned char
can somebody repair my code please!!!!
Thanks