diff --git a/ESP-IDF_Robot/tutorial/docs/build/doctrees/environment.pickle b/ESP-IDF_Robot/tutorial/docs/build/doctrees/environment.pickle index 4042d8a3a..b38b97085 100644 Binary files a/ESP-IDF_Robot/tutorial/docs/build/doctrees/environment.pickle and b/ESP-IDF_Robot/tutorial/docs/build/doctrees/environment.pickle differ diff --git a/ESP-IDF_Robot/tutorial/docs/build/doctrees/overview.doctree b/ESP-IDF_Robot/tutorial/docs/build/doctrees/overview.doctree index 698187410..00495be34 100644 Binary files a/ESP-IDF_Robot/tutorial/docs/build/doctrees/overview.doctree and b/ESP-IDF_Robot/tutorial/docs/build/doctrees/overview.doctree differ diff --git a/ESP-IDF_Robot/tutorial/docs/build/html/_sources/overview.rst.txt b/ESP-IDF_Robot/tutorial/docs/build/html/_sources/overview.rst.txt index 2083ae7ae..52c876fe6 100644 --- a/ESP-IDF_Robot/tutorial/docs/build/html/_sources/overview.rst.txt +++ b/ESP-IDF_Robot/tutorial/docs/build/html/_sources/overview.rst.txt @@ -53,15 +53,51 @@ Changing PWM on each channel determines the speed and direction of the RC car. Fusion of Software & Hardware ----------------------------- +The *struct* for storing motors PWM values. + .. code-block:: c struct motors_rpm { - int motor1_rpm_pcm; - int motor2_rpm_pcm; - int motor3_rpm_pcm; - int motor4_rpm_pcm; + int motor1_rpm_pwm; + int motor2_rpm_pwm; + int motor3_rpm_pwm; + int motor4_rpm_pwm; }; +The function for updating motors' PWM values. + +.. code-block:: c + + // Function to send data to the receiver + void sendData (void) { + sensors_data_t buffer; // Declare data struct + + buffer.crc = 0; + buffer.x_axis = 0; + buffer.y_axis = 0; + buffer.nav_bttn = 0; + buffer.motor1_rpm_pwm = 0; + buffer.motor2_rpm_pwm = 0; + buffer.motor3_rpm_pwm = 0; + buffer.motor4_rpm_pwm = 0; + + // Display brief summary of data being sent. + ESP_LOGI(TAG, "Joystick (x,y) position ( 0x%04X, 0x%04X )", (uint8_t)buffer.x_axis, (uint8_t)buffer.y_axis); + ESP_LOGI(TAG, "pwm 1, pwm 2 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm); + ESP_LOGI(TAG, "pwm 3, pwm 4 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm); + + // Call ESP-NOW function to send data (MAC address of receiver, pointer to the memory holding data & data length) + uint8_t result = esp_now_send(receiver_mac, &buffer, sizeof(buffer)); + + // If status is NOT OK, display error message and error code (in hexadecimal). + if (result != 0) { + ESP_LOGE("ESP-NOW", "Error sending data! Error code: 0x%04X", result); + deletePeer(); + } + else + ESP_LOGW("ESP-NOW", "Data was sent."); + } + Schematic --------- diff --git a/ESP-IDF_Robot/tutorial/docs/build/html/overview.html b/ESP-IDF_Robot/tutorial/docs/build/html/overview.html index f63eb23ea..3bef3782f 100644 --- a/ESP-IDF_Robot/tutorial/docs/build/html/overview.html +++ b/ESP-IDF_Robot/tutorial/docs/build/html/overview.html @@ -103,14 +103,47 @@ Changing PWM on each channel determines the speed and direction of the RC car.

Fusion of Software & Hardware

+

The struct for storing motors PWM values.

struct motors_rpm {
-    int motor1_rpm_pcm;
-    int motor2_rpm_pcm;
-    int motor3_rpm_pcm;
-    int motor4_rpm_pcm;
+    int motor1_rpm_pwm;
+    int motor2_rpm_pwm;
+    int motor3_rpm_pwm;
+    int motor4_rpm_pwm;
 };
 
+

The function for updating motors’ PWM values.

+
// Function to send data to the receiver
+void sendData (void) {
+    sensors_data_t buffer;              // Declare data struct
+
+    buffer.crc = 0;
+    buffer.x_axis = 0;
+    buffer.y_axis = 0;
+    buffer.nav_bttn = 0;
+    buffer.motor1_rpm_pwm = 0;
+    buffer.motor2_rpm_pwm = 0;
+    buffer.motor3_rpm_pwm = 0;
+    buffer.motor4_rpm_pwm = 0;
+
+    // Display brief summary of data being sent.
+    ESP_LOGI(TAG, "Joystick (x,y) position ( 0x%04X, 0x%04X )", (uint8_t)buffer.x_axis, (uint8_t)buffer.y_axis);
+    ESP_LOGI(TAG, "pwm 1, pwm 2 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm);
+    ESP_LOGI(TAG, "pwm 3, pwm 4 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm);
+
+    // Call ESP-NOW function to send data (MAC address of receiver, pointer to the memory holding data & data length)
+    uint8_t result = esp_now_send(receiver_mac, &buffer, sizeof(buffer));
+
+    // If status is NOT OK, display error message and error code (in hexadecimal).
+    if (result != 0) {
+        ESP_LOGE("ESP-NOW", "Error sending data! Error code: 0x%04X", result);
+        deletePeer();
+    }
+    else
+        ESP_LOGW("ESP-NOW", "Data was sent.");
+}
+
+

Schematic

diff --git a/ESP-IDF_Robot/tutorial/docs/build/html/searchindex.js b/ESP-IDF_Robot/tutorial/docs/build/html/searchindex.js index b5bf202ec..005c5f2ec 100644 --- a/ESP-IDF_Robot/tutorial/docs/build/html/searchindex.js +++ b/ESP-IDF_Robot/tutorial/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles":{"ByteRider documentation":[[0,null]],"Chassis":[[3,"chassis"]],"Direction and Speed":[[2,"direction-and-speed"]],"Finished Work":[[3,"finished-work"]],"Fusion of Software & Hardware":[[2,"fusion-of-software-hardware"]],"HOW DOES IT WORK?":[[2,null]],"INTRODUCTION":[[1,null]],"Motor Wires Harness":[[3,"motor-wires-harness"]],"Reserved Pins & GPIOs":[[2,"reserved-pins-gpios"]],"Schematic":[[2,"schematic"]],"WORK-IN-PROGRESS WALK THROUGH":[[3,null]],"Wiring":[[3,"wiring"]],"x- and y- axis":[[2,"x-and-y-axis"]]},"docnames":["index","intro","overview","progress"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2},"filenames":["index.rst","intro.rst","overview.rst","progress.rst"],"indexentries":{},"objects":{},"objnames":{},"objtypes":{},"terms":{"0":2,"1":2,"15":2,"16":2,"2":2,"3":2,"4":2,"5":2,"6":2,"7":2,"8":2,"A":2,"IN":0,"IT":0,"In":2,"The":2,"__gpio6__":[],"_static":[],"adapt":2,"adc1_ch0":2,"adc1_ch1":2,"add":0,"ani":2,"ar":2,"assign":2,"axi":[],"back":2,"base":2,"below":[],"bitbyterid":2,"board":2,"breadboard":2,"button":2,"c3":2,"can":2,"car":2,"chang":2,"channel":2,"chassi":0,"clockwis":2,"code":[],"column":[],"complet":3,"consequ":2,"constraint":2,"content":0,"control":[2,3],"correspond":2,"counter":2,"data":[],"dc":[2,3],"dedic":2,"defin":2,"detail":0,"determin":2,"develop":2,"developmemt":2,"diagon":2,"direct":[],"doe":0,"e":2,"each":2,"esp":[],"esp32":2,"exist":[],"finish":0,"follow":2,"four":2,"front":2,"function":2,"fusion":0,"gpio":0,"gpio0":2,"gpio1":2,"gpio4":2,"gpio5":2,"gpio6":2,"gpio7":2,"group":2,"har":0,"hardwar":0,"harn":3,"how":0,"i":2,"idf_robot_schemat":[],"imag":[],"insid":3,"instal":3,"int":2,"introduct":0,"joystick":2,"lastli":2,"ledc_channel_0":2,"ledc_channel_1":2,"ledc_channel_2":2,"ledc_channel_3":2,"left":2,"mean":2,"measur":2,"microcontrol":2,"motor":[0,2],"motor1_rpm_pcm":2,"motor2_rpm_pcm":2,"motor3_rpm_pcm":2,"motor4_rpm_pcm":2,"motors_rpm":2,"move":2,"movement":2,"note":2,"number":2,"onli":[2,3],"oper":2,"other":2,"pair":2,"particular":2,"pin":0,"png":[],"possibl":2,"power":2,"progress":0,"provid":2,"purpos":2,"push":2,"pwm":2,"rc":2,"requir":2,"reserv":0,"respons":2,"restructuredtext":0,"right":2,"rotat":2,"row":[],"same":[],"schemat":0,"secur":3,"see":0,"side":2,"similarli":2,"softwar":0,"speed":[],"struct":2,"summar":2,"syntax":0,"tabl":2,"thi":2,"those":2,"through":0,"two":2,"us":0,"voltag":2,"walk":0,"well":[],"wire":[0,2],"work":0,"wroom":2,"x":[],"y":[],"your":0},"titles":["ByteRider documentation","INTRODUCTION","HOW DOES IT WORK?","WORK-IN-PROGRESS WALK THROUGH"],"titleterms":{"IN":3,"IT":2,"axi":2,"byterid":0,"chassi":3,"direct":2,"document":0,"doe":2,"finish":3,"fusion":2,"gpio":2,"har":3,"hardwar":2,"how":2,"introduct":1,"motor":3,"pin":2,"progress":3,"reserv":2,"schemat":2,"softwar":2,"speed":2,"through":3,"walk":3,"wire":3,"work":[2,3],"x":2,"y":2}}) \ No newline at end of file +Search.setIndex({"alltitles":{"ByteRider documentation":[[0,null]],"Chassis":[[3,"chassis"]],"Direction and Speed":[[2,"direction-and-speed"]],"Finished Work":[[3,"finished-work"]],"Fusion of Software & Hardware":[[2,"fusion-of-software-hardware"]],"HOW DOES IT WORK?":[[2,null]],"INTRODUCTION":[[1,null]],"Motor Wires Harness":[[3,"motor-wires-harness"]],"Reserved Pins & GPIOs":[[2,"reserved-pins-gpios"]],"Schematic":[[2,"schematic"]],"WORK-IN-PROGRESS WALK THROUGH":[[3,null]],"Wiring":[[3,"wiring"]],"x- and y- axis":[[2,"x-and-y-axis"]]},"docnames":["index","intro","overview","progress"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2},"filenames":["index.rst","intro.rst","overview.rst","progress.rst"],"indexentries":{},"objects":{},"objnames":{},"objtypes":{},"terms":{"0":2,"04x":2,"0x":2,"1":2,"15":2,"16":2,"2":2,"3":2,"4":2,"5":2,"6":2,"7":2,"8":2,"A":2,"IN":0,"IT":0,"If":2,"In":2,"NOT":2,"The":2,"__gpio6__":[],"_static":[],"adapt":2,"adc1_ch0":2,"adc1_ch1":2,"add":0,"address":2,"ani":2,"ar":2,"assign":2,"axi":[],"back":2,"base":2,"being":2,"below":[],"bitbyterid":2,"board":2,"breadboard":2,"brief":2,"buffer":2,"button":2,"c3":2,"call":2,"can":2,"car":2,"chang":2,"channel":2,"chassi":0,"clockwis":2,"code":2,"column":[],"complet":3,"consequ":2,"constraint":2,"content":0,"control":[2,3],"correspond":2,"counter":2,"crc":2,"data":2,"dc":[2,3],"declar":2,"dedic":2,"defin":2,"deletep":2,"detail":0,"determin":2,"develop":2,"developmemt":2,"diagon":2,"direct":[],"displai":2,"doe":0,"e":2,"each":2,"els":2,"error":2,"esp":2,"esp32":2,"esp_log":2,"esp_logi":2,"esp_logw":2,"esp_now_send":2,"exist":[],"finish":0,"follow":2,"four":2,"front":2,"function":2,"fusion":0,"gpio":0,"gpio0":2,"gpio1":2,"gpio4":2,"gpio5":2,"gpio6":2,"gpio7":2,"group":2,"har":0,"hardwar":0,"harn":3,"hexadecim":2,"hold":2,"how":0,"i":2,"idf_robot_schemat":[],"imag":[],"insid":3,"instal":3,"int":2,"introduct":0,"joystick":2,"lastli":2,"ledc_channel_0":2,"ledc_channel_1":2,"ledc_channel_2":2,"ledc_channel_3":2,"left":2,"length":2,"mac":2,"mean":2,"measur":2,"memori":2,"messag":2,"microcontrol":2,"motor":[0,2],"motor1_rpm_pcm":[],"motor1_rpm_pwm":2,"motor2_rpm_pcm":[],"motor2_rpm_pwm":2,"motor3_rpm_pcm":[],"motor3_rpm_pwm":2,"motor4_rpm_pcm":[],"motor4_rpm_pwm":2,"motors_rpm":2,"move":2,"movement":2,"nav_bttn":2,"note":2,"now":2,"number":2,"ok":2,"onli":[2,3],"oper":2,"other":2,"pair":2,"particular":2,"pin":0,"png":[],"pointer":2,"posit":2,"possibl":2,"power":2,"progress":0,"provid":2,"purpos":2,"push":2,"pwm":2,"rc":2,"receiv":2,"receiver_mac":2,"requir":2,"reserv":0,"respons":2,"restructuredtext":0,"result":2,"right":2,"rotat":2,"row":[],"same":[],"schemat":0,"secur":3,"see":0,"send":2,"senddata":2,"sensors_data_t":2,"sent":2,"side":2,"similarli":2,"sizeof":2,"softwar":0,"speed":[],"statu":2,"store":2,"struct":2,"summar":2,"summari":2,"syntax":0,"tabl":2,"tag":2,"thi":2,"those":2,"through":0,"two":2,"uint8_t":2,"updat":2,"us":0,"valu":2,"void":2,"voltag":2,"wa":2,"walk":0,"well":[],"wire":[0,2],"work":0,"wroom":2,"x":[],"x_axi":2,"y":[],"y_axi":2,"your":0},"titles":["ByteRider documentation","INTRODUCTION","HOW DOES IT WORK?","WORK-IN-PROGRESS WALK THROUGH"],"titleterms":{"IN":3,"IT":2,"axi":2,"byterid":0,"chassi":3,"direct":2,"document":0,"doe":2,"finish":3,"fusion":2,"gpio":2,"har":3,"hardwar":2,"how":2,"introduct":1,"motor":3,"pin":2,"progress":3,"reserv":2,"schemat":2,"softwar":2,"speed":2,"through":3,"walk":3,"wire":3,"work":[2,3],"x":2,"y":2}}) \ No newline at end of file diff --git a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/.buildinfo b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/.buildinfo index 5e1e37409..17cf1d7b0 100644 --- a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/.buildinfo +++ b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 08f3115b2bc206aca8fd1cef44091c9d +config: fe817b8ae9ec9fe845785e22f5756e04 tags: 62a1e7829a13fc7881b6498c52484ec0 diff --git a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/esp-idf_espnow_rc-car.pdf b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/esp-idf_espnow_rc-car.pdf index 2f947a687..e286c31c1 100644 Binary files a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/esp-idf_espnow_rc-car.pdf and b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/esp-idf_espnow_rc-car.pdf differ diff --git a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/index.html b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/index.html index 0b8e67538..d1bcea025 100644 --- a/ESP-IDF_Robot/tutorial/docs/build/simplepdf/index.html +++ b/ESP-IDF_Robot/tutorial/docs/build/simplepdf/index.html @@ -431,14 +431,58 @@ Changing PWM on each channel determines the speed and direction of the RC car. ¶ +

+ The + + struct + + for storing motors PWM values. +

struct motors_rpm {
-    int motor1_rpm_pcm;
-    int motor2_rpm_pcm;
-    int motor3_rpm_pcm;
-    int motor4_rpm_pcm;
+    int motor1_rpm_pwm;
+    int motor2_rpm_pwm;
+    int motor3_rpm_pwm;
+    int motor4_rpm_pwm;
 };
+
+
+
+

+ The function for updating motors’ PWM values. +

+
+
+
// Function to send data to the receiver
+void sendData (void) {
+    sensors_data_t buffer;              // Declare data struct
+
+    buffer.crc = 0;
+    buffer.x_axis = 0;
+    buffer.y_axis = 0;
+    buffer.nav_bttn = 0;
+    buffer.motor1_rpm_pwm = 0;
+    buffer.motor2_rpm_pwm = 0;
+    buffer.motor3_rpm_pwm = 0;
+    buffer.motor4_rpm_pwm = 0;
+
+    // Display brief summary of data being sent.
+    ESP_LOGI(TAG, "Joystick (x,y) position ( 0x%04X, 0x%04X )", (uint8_t)buffer.x_axis, (uint8_t)buffer.y_axis);
+    ESP_LOGI(TAG, "pwm 1, pwm 2 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm);
+    ESP_LOGI(TAG, "pwm 3, pwm 4 [ 0x%04X, 0x%04X ]", (uint8_t)buffer.pwm, (uint8_t)buffer.pwm);
+
+    // Call ESP-NOW function to send data (MAC address of receiver, pointer to the memory holding data & data length)
+    uint8_t result = esp_now_send(receiver_mac, &buffer, sizeof(buffer));
+
+    // If status is NOT OK, display error message and error code (in hexadecimal).
+    if (result != 0) {
+        ESP_LOGE("ESP-NOW", "Error sending data! Error code: 0x%04X", result);
+        deletePeer();
+    }
+    else
+        ESP_LOGW("ESP-NOW", "Data was sent.");
+}