Skip to content

Commit

Permalink
V1.0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
desiFish committed Mar 25, 2023
1 parent 0605c20 commit d5cf300
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions smartAquariumProto/smartAquariumProto.ino
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ void relayInitialize()
}
}

// ESPNOW#####################################################
// REPLACE WITH RECEIVER MAC Address
// REMOVE this section if you don't want to broadcast time data to other ESPs #####################################################
// ESPNOW: REPLACE WITH RECEIVER MAC Address
uint8_t broadcastAddress[] = { 0xF4, 0xCF, 0xA2, 0xF0, 0x0A, 0xE3 };
// Structure example to send data
// Must match the receiver structure
Expand All @@ -411,7 +411,6 @@ typedef struct struct_message {
} struct_message;

struct_message myData;

/*
Callback when data is sent
*/
Expand All @@ -423,6 +422,8 @@ void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) {
Serial.println("Delivery fail");
}
}
// ESPNOW END #####################################################


/*
Replaces placeholder with button section in your web page
Expand Down Expand Up @@ -1599,6 +1600,7 @@ void setup() {
// Start server
server.begin();

//REMOVE this section if you don't want to broadcast time data to other ESPs ############################################
// Init ESP-NOW
if (esp_now_init() != 0) {
display.println(F("Error in ESP-NOW"));
Expand All @@ -1617,6 +1619,7 @@ void setup() {

// Register peer
esp_now_add_peer(broadcastAddress, ESP_NOW_ROLE_SLAVE, 1, NULL, 0);
// ESP NOW ENDS ###################################################################################

display.println(F("SETTING RELAYS"));
Serial.println("Setting Relays");
Expand Down Expand Up @@ -1893,6 +1896,8 @@ void loop() {
lastTime1 = millis();
}


//REMOVE this section if you don't want to broadcast time data to other ESPs ############################################
// ESP NOW Send time
if ((millis() - lastTime2) > timerDelay2) {
// Set values to send
Expand All @@ -1907,6 +1912,7 @@ void loop() {

// Send message via ESP-NOW
esp_now_send(broadcastAddress, (uint8_t *)&myData, sizeof(myData));
//ESP NOW END #################################################################################

lastTime2 = millis();
}
Expand Down

0 comments on commit d5cf300

Please sign in to comment.