初始化提交
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
[platformio]
|
||||
src_dir = .
|
||||
lib_extra_dirs = .piolibdeps/, ../../
|
||||
|
||||
[env:nodemcuv2]
|
||||
platform = espressif8266
|
||||
board = nodemcuv2
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
ArduinoJson
|
||||
# painlessMesh
|
||||
Reference in New Issue
Block a user