Comments (1)
my code:
#include <Arduino.h>
#include <EspNowFloodingMesh.h>
#include <WiFi.h>
#include <time.h>
#define LED 2
#define ESP_NOW_CHANNEL 1
#define B_SSID 14
//AES 128bit
unsigned char secredKey[] = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE, 0xFF};
void espNowFloodingMeshRecv(const uint8_t data, int len, uint32_t replyPrt){
if(len>0) {
Serial.println((const char)data);
}
}
//----------------------------------------
//####################################################################
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_MODE_STA);
Serial.println(WiFi.macAddress());
//Set device in AP mode to begin with
espNowFloodingMesh_RecvCB(espNowFloodingMeshRecv);
espNowFloodingMesh_begin(ESP_NOW_CHANNEL, B_SSID);
espNowFloodingMesh_secredkey(secredKey);
espNowFloodingMesh_setToBatteryNode();
//Ask instant sync from master.
espNowFloodingMesh_requestInstantTimeSyncFromMaster();
while(espNowFloodingMesh_isSyncedWithMaster()==false);
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
}
//####################################################################
//####################################################################
void loop() {
static unsigned long m = millis();
//Ask instant sync from master.
if(m+5000<millis()) {
char message[] = "SLAVE HELLO MESSAGE";
espNowFloodingMesh_send((uint8_t*)message, sizeof(message), 3); //set ttl to 3
m = millis();
}
espNowFloodingMesh_loop();
delay(10);
}
//####################################################################
from espnowfloodingmeshlibrary2.
Related Issues (8)
- Thanks and a few suggestions for telemetry HOT 1
- Missing functions HOT 1
- upgrade HOT 4
- Esp32-c3 compatibility ? HOT 6
- Messages recieved but ignored due to CRC mismatch, when mixing ESP8266 and ESP32 devices HOT 7
- [BUG] Compile error with ESP32 HOT 1
- Will ESP NOW Mesh Support 1000 nodes Connected in a line(Street Light) each 50-100 meter apart HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espnowfloodingmeshlibrary2.