mirror of
https://gitlab.waag.org/make/fablab/interns/2025/sam.git
synced 2025-08-03 20:04:56 +00:00
explanation intergration ESPNow into drone code
This commit is contained in:
@@ -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.
|
||||
|
||||

|
||||
|
||||
After that I added the global variables for the ESPNow protocol.
|
||||
|
||||

|
||||
|
||||
Then I uncommented `RadioSetup()` again so it could be used again and I added a case for my ESPNow protocol.
|
||||

|
||||
|
||||
|
||||
In the PWM receive function I added an additional case so my PWM values actually get intergrated into the code.
|
||||
|
||||

|
||||
|
||||
At the end of the program I added the ESPNow Initialisation function and the callback function for when the data is received.
|
||||
|
||||

|
||||
|
||||
When I comppile it now it should work.
|
||||
|
||||
## Sources
|
||||
### Code
|
||||
|
Reference in New Issue
Block a user