ICP DAS USA LinPAC AM335 Series User Manual page 129

Hide thumbs Also See for LinPAC AM335 Series:
Table of Contents

Advertisement

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 publishing 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
AM335X-PAC Series User Manual
version 2.0.4
Page: 129
Copyright © 2021 ICP DAS Co., Ltd. All Rights Reserved.
E-mail: service@icpdas.com

Advertisement

Table of Contents
loading

Table of Contents