explanation intergration ESPNow into drone code

This commit is contained in:
2025-02-18 15:45:29 +01:00
parent 67b283ef3b
commit a08ed6c5a8

View File

@@ -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 <Arduino.h>
#include <SparkFun_BNO080_Arduino_Library.h>
#include <PWMServo.h>
#include <esp_now.h>
#include <WiFi.h>
```
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