Inputs and outputs
d. Click Finish.
e. The MainApp.java file is automatically opened in the editor. Replace its contents with the
source code you copied in the previous step.
f. A line at the top of the pasted code is underlined in red. Click on that line; a pop-up appears.
Select the first option (Move 'MainApp.java' to package '...') to resolve the error.
Option 2: NetBeans
a. In the Projects view, select the project and right-click.
b. From the context menu, select New > Java Class... The New Java Class wizard opens.
c. Modify the Class Name to be MainApp.
d. Click Finish.
e. The MainApp.java file automatically opens in the editor. Replace its contents with the source
code you copied in the previous step.
f. A line at the top of the pasted code is underlined in red. Click on the light bulb next to that line;
a pop-up appears. Select the first option (Move class to correct folder) to resolve the error.
Step 7: Set the port name and launch the application
For this step, set the port name and launch the application.
1. Change the port name in the Java source code to match the port that the receiver (COORD) is
connected to.
// TODO: Replace with the port where your coordinator module is connected
private static final String PORT = "COM1";
// TODO: Replace with the baud rate of your coordinator module.
private static final int BAUD_RATE = 9600
Note
If you are using a Grove sensor connected to AD2, make this additional code change to
select the correct IO Line:
2. Launch the application on your computer. Every five seconds, you will receive the value of the
potentiometer connected to ROUTER and END_DEVICE (senders). Rotate them and see that
the values change.
3. The output of the application should be similar to the following:
4.
+---------------------------------------+
|
Receive Analog Data Sample
+---------------------------------------+
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Analog data from '0013A20011111111': 227
Analog data from '0013A20022222222': 0
Analog data from '0013A20011111111': 113
Analog data from '0013A20022222222': 1023
XBee® Zigbee® Mesh Kit
Lab: receive analog data
|
118
Need help?
Do you have a question about the XBee Zigbee Mesh Kit and is the answer not in the manual?