Skip to content

Commit

Permalink
reviewed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jun 21, 2024
1 parent 40a2edc commit 04ca777
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,7 @@ void setup() {
}

// Set the nodeID to 0 for the master node
mesh.setNodeID(0);
Serial.println(mesh.getNodeID());
// Connect to the mesh
if (!mesh.begin()) {
// if mesh.begin() returns false for a master node, then radio.begin() returned false.
Serial.println(F("Radio hardware not responding."));
while (1) {
// hold in an infinite loop
}
}
mesh.setNodeID(0); // must be called before setStaticAddress()

// In this case, assign a static address to nodeIDs 23,24 at RF24Network address 02 && 03
// This will prevent this master node from assigning the address to another node
Expand All @@ -51,10 +42,20 @@ void setup() {
// With this example, assign nodes 02 and 03 statically. This allows child nodes to join
// the network as children of 00(master), node 02, or node 03, or as children of other
// mesh nodes. If nodes 02 and 03 are placed in proximity to a group of mesh nodes, the
// mesh nodes can attatch to the network via the static nodes, and route traffic through
// mesh nodes can attach to the network via the static nodes, and route traffic through
// either node, to the master node.
mesh.setStaticAddress(23, 02);
mesh.setStaticAddress(24, 03);

Serial.println(mesh.getNodeID());
// Connect to the mesh
if (!mesh.begin()) {
// if mesh.begin() returns false for a master node, then radio.begin() returned false.
Serial.println(F("Radio hardware not responding."));
while (1) {
// hold in an infinite loop
}
}
}

uint32_t displayTimer = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/RF24Mesh_SerialConfig/RF24Mesh_SerialConfig.ino
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setup() {
while (!mesh.getNodeID()) {
// Wait for the nodeID to be set via Serial
if (Serial.available()) {
mesh.setNodeID(Serial.read());
mesh.setNodeID(Serial.parseInt() & 0xFF);
Serial.print("Set NodeID: ");
Serial.println(mesh.getNodeID());
}
Expand Down

0 comments on commit 04ca777

Please sign in to comment.