I've got the following code for the UART,
Code: Select all
int sendData(const char* logName, const char* data)
{
const int len = strlen(data);
const int txBytes = uart_write_bytes(UART_NUM_2, data, len);
ESP_LOGI(logName, "Wrote %d bytes", txBytes);
return txBytes;
}
static void tx_task()
{
static const char *TX_TASK_TAG = "TX_TASK";
while (1) {
sendData(TX_TASK_TAG, "0xA000004F");
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
}