初始化提交

This commit is contained in:
王立帮
2024-07-20 22:09:06 +08:00
commit c247dd07a6
6876 changed files with 2743096 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
//************************************************************
// this is a simple example that uses the painlessMesh library and echos any
// messages it receives
//
//************************************************************
#include "painlessMesh.h"
#define MESH_PREFIX "whateverYouLike"
#define MESH_PASSWORD "somethingSneaky"
#define MESH_PORT 5555
// Prototypes
void receivedCallback( uint32_t from, String &msg );
painlessMesh mesh;
void setup() {
Serial.begin(115200);
mesh.setDebugMsgTypes( ERROR | STARTUP | CONNECTION ); // set before init() so that you can see startup messages
mesh.init( MESH_PREFIX, MESH_PASSWORD, MESH_PORT );
mesh.onReceive(&receivedCallback);
}
void loop() {
mesh.update();
}
void receivedCallback( uint32_t from, String &msg ) {
Serial.printf("echoNode: Received from %u msg=%s\n", from, msg.c_str());
mesh.sendSingle(from, msg);
}

View File

@@ -0,0 +1,11 @@
[platformio]
src_dir = .
lib_extra_dirs = .piolibdeps/, ../../
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =
ArduinoJson
# painlessMesh