Skip to content

Commit 05a2ab6

Browse files
committed
reviewed examples
1 parent 62cc497 commit 05a2ab6

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

examples/RF24Mesh_Example_Master_Statics/RF24Mesh_Example_Master_Statics.ino

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,7 @@ void setup() {
3232
}
3333

3434
// Set the nodeID to 0 for the master node
35-
mesh.setNodeID(0);
36-
Serial.println(mesh.getNodeID());
37-
// Connect to the mesh
38-
if (!mesh.begin()) {
39-
// if mesh.begin() returns false for a master node, then radio.begin() returned false.
40-
Serial.println(F("Radio hardware not responding."));
41-
while (1) {
42-
// hold in an infinite loop
43-
}
44-
}
35+
mesh.setNodeID(0); // must be called before setStaticAddress()
4536

4637
// In this case, assign a static address to nodeIDs 23,24 at RF24Network address 02 && 03
4738
// This will prevent this master node from assigning the address to another node
@@ -51,10 +42,20 @@ void setup() {
5142
// With this example, assign nodes 02 and 03 statically. This allows child nodes to join
5243
// the network as children of 00(master), node 02, or node 03, or as children of other
5344
// mesh nodes. If nodes 02 and 03 are placed in proximity to a group of mesh nodes, the
54-
// mesh nodes can attatch to the network via the static nodes, and route traffic through
45+
// mesh nodes can attach to the network via the static nodes, and route traffic through
5546
// either node, to the master node.
5647
mesh.setStaticAddress(23, 02);
5748
mesh.setStaticAddress(24, 03);
49+
50+
Serial.println(mesh.getNodeID());
51+
// Connect to the mesh
52+
if (!mesh.begin()) {
53+
// if mesh.begin() returns false for a master node, then radio.begin() returned false.
54+
Serial.println(F("Radio hardware not responding."));
55+
while (1) {
56+
// hold in an infinite loop
57+
}
58+
}
5859
}
5960

6061
uint32_t displayTimer = 0;

examples/RF24Mesh_SerialConfig/RF24Mesh_SerialConfig.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void setup() {
4141
while (!mesh.getNodeID()) {
4242
// Wait for the nodeID to be set via Serial
4343
if (Serial.available()) {
44-
mesh.setNodeID(Serial.read());
44+
mesh.setNodeID(Serial.parseInt() & 0xFF);
4545
Serial.print("Set NodeID: ");
4646
Serial.println(mesh.getNodeID());
4747
}

0 commit comments

Comments
 (0)