added functionality for a camera controller

This commit is contained in:
2026-05-06 20:47:46 +02:00
parent 3d9a1a778c
commit bba3a5d50b
2 changed files with 141 additions and 9 deletions
+25 -9
View File
@@ -13,7 +13,7 @@
// 1 = Red Team Button
// 2 = Blue Team Button
const bool writeBoardID = false;
int boardID = 1;
int boardID = 0;
// set Arena, switches the MAC addresses out
// 1 = Arena A (Ant)
@@ -54,9 +54,13 @@ bool sendDATAvar = false;
#if ARENA == 1
// A Arena Controller MAC Address
uint8_t broadcastAddress[] = {0x84, 0xFC, 0xE6, 0xC7, 0x1A, 0x8C};
// Additional receiver MAC address
uint8_t extraReceiverMAC[] = { 0x78, 0x42, 0x1C, 0x6B, 0x2A, 0x4C }; // replace with real MAC
#elif ARENA == 2
// B Arena Controller MAC Address
uint8_t broadcastAddress[] = {0xD8, 0x3B, 0xDA, 0xC9, 0x0C, 0xEE};
// Additional receiver MAC address
uint8_t extraReceiverMAC[] = { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; // replace with real MAC
#endif
// Structure example to send data
@@ -86,8 +90,6 @@ typedef struct struct_message_receive {
// Create instance for receiving ESP-NOW data
struct_message_receive receiveDATA;
esp_now_peer_info_t peerInfo;
Preferences preferences;
// callback when data is sent
@@ -138,13 +140,25 @@ void setup() {
// get the status of Transmitted packet
esp_now_register_send_cb(OnDataSent);
// Register peer
memcpy(peerInfo.peer_addr, broadcastAddress, 6);
peerInfo.channel = 0;
peerInfo.encrypt = false;
// Register peer 1 (arena controller)
esp_now_peer_info_t peerInfo1 = {};
memcpy(peerInfo1.peer_addr, broadcastAddress, 6);
peerInfo1.channel = 0;
peerInfo1.encrypt = false;
// Add peer
if (esp_now_add_peer(&peerInfo) != ESP_OK){
Serial.println("Failed to add peer");
if (esp_now_add_peer(&peerInfo1) != ESP_OK){
Serial.println("Failed to add peer1");
return;
}
// Register peer 2 (extra receiver)
esp_now_peer_info_t peerInfo2 = {};
memcpy(peerInfo2.peer_addr, extraReceiverMAC, 6);
peerInfo2.channel = 0;
peerInfo2.encrypt = false;
// Add peer
if (esp_now_add_peer(&peerInfo2) != ESP_OK){
Serial.println("Failed to add peer2");
return;
}
@@ -183,6 +197,8 @@ void sendDATA_to_controller() {
sendDATA.buttonBLUETEAMtapout = buttonBLUETEAMtapout;
// send data
esp_err_t result = esp_now_send(broadcastAddress, (uint8_t *) &sendDATA, sizeof(sendDATA));
esp_now_send(extraReceiverMAC, (uint8_t *) &sendDATA, sizeof(sendDATA));
// check if transmission was successfull
// if (result == ESP_OK) {
// Serial.println("Sent with success");