mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 14:20:51 +00:00
RC Robot Tutorial
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user