![ICP DAS USA LP-22 Series User Manual Download Page 124](http://html.mh-extra.com/html/icp-das-usa/lp-22-series/lp-22-series_user-manual_3722566124.webp)
AM335X-PAC Series User Manual version 2.0.1 Page: 124
Copyright © 2019 ICP DAS Co., Ltd. All Rights Reserved. E-mail: [email protected]
Figure 7.3-5.
Subscribing to a topic
Step 3: Managing topics and publishing.
On the LP-9x2x module, use the following command to publish a message from the LP-9x2x
module to the MQ-7255M module via the MQTT Broker.
#
mosquitto_pub -h <broker IP> -p 1883 -q 0 -t MQ7255M/
SetValue
/DO1
–m ‘1’
In this example
, the topic being published is ‘MQ7255M/SetValue/DO1’
. We can use the
command to turn the device OFF or ON by publishi
ng the status value ‘0’ or ‘1’
for the DO1
channel to
the topic ‘MQ7255M/SetValue/DO1’
. In a similar way, we can also publish changes to
the I/O value to the relevant topic, which then allows us to control the device.
Step 4: Verify that the value of the subscription topic
‘
MQ7255M/
GetValue
/DO1’
has changed.
You can determine if there are any variations in the DO1 value by monitoring the changes in the
value published to the ‘MQ7255M/GetValue/DO1’ topic, as illustrated
in Figure 7.3-6 below.
Figure 7.3-6.
Monitor the variation in the DO1 value