From a08ed6c5a8e0b4ea950e7b97a7c6f22b61c9dc18 Mon Sep 17 00:00:00 2001 From: Sam Hos Date: Tue, 18 Feb 2025 15:45:29 +0100 Subject: [PATCH] explanation intergration ESPNow into drone code --- .../week_4_programming/programming.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/Assignments/week_4_programming/programming.md b/docs/Assignments/week_4_programming/programming.md index 43ffdc7..421ca5f 100644 --- a/docs/Assignments/week_4_programming/programming.md +++ b/docs/Assignments/week_4_programming/programming.md @@ -658,6 +658,37 @@ Result of bridging ground and the antenna. Sadly didn't work. After that I grabb Now I can start intergrating the code into the drone driver. +The first thing I did is add the correct libraries at the top of the file. So it looks like this now + +```cpp +#include +#include +#include +#include +#include +``` + +After that I added my own ESPNow define so I could use that later on in the code. I want the code to stay variable and user specified so thats why im continuing the way it was made. + +![alt text](image-29.png) + +After that I added the global variables for the ESPNow protocol. + +![alt text](image-30.png) + +Then I uncommented `RadioSetup()` again so it could be used again and I added a case for my ESPNow protocol. + ![alt text](image-31.png) + + +In the PWM receive function I added an additional case so my PWM values actually get intergrated into the code. + +![alt text](image-32.png) + +At the end of the program I added the ESPNow Initialisation function and the callback function for when the data is received. + +![alt text](image-33.png) + +When I comppile it now it should work. ## Sources ### Code