RC Robot Tutorial

This commit is contained in:
2025-07-21 03:05:34 -04:00
parent f3ea17316c
commit 40be7393a0

View File

@@ -215,6 +215,18 @@ On the transmitter`` device, the PWM values for the DC motors are send to the re
ESP_LOGW("ESP-NOW", "Data was sent."); ESP_LOGW("ESP-NOW", "Data was sent.");
} }
As data is being sent, the function onDataSent() is called to display the status of the data transmission.
.. code-block:: c
// Call-back for the event when data is being sent
void onDataSent (uint8_t *mac_addr, esp_now_send_status_t status) {
ESP_LOGW(TAG, "Packet send status: 0x%04X", status);
}
... ... ...
... ... ...
On the receiver device, the data is saved in the variables by the call-back function onDataReceived(). On the receiver device, the data is saved in the variables by the call-back function onDataReceived().
.. code-block:: c .. code-block:: c
@@ -229,11 +241,6 @@ On the receiver device, the data is saved in the variables by the call-back func
ESP_LOGI(TAG, "PWM 1: 0x%04x", buf->motor1_rpm_pwm); ESP_LOGI(TAG, "PWM 1: 0x%04x", buf->motor1_rpm_pwm);
} }
// Call-back for the event when data is being sent
void onDataSent (uint8_t *mac_addr, esp_now_send_status_t status) {
ESP_LOGW(TAG, "Packet send status: 0x%04X", status);
}
The rc_send_data_task() function runs every 0.1 second to transmit the data to the receiver. The rc_send_data_task() function runs every 0.1 second to transmit the data to the receiver.
.. code-block:: c .. code-block:: c