Samples

The following samples illustrate the communication with an MQTT broker. Messages are sent and received.

There are two different implementation options, which can be chosen based on purely subjective criteria. The two options are compared in the first two samples.

Overview

Sample

Link

Description

1

IotMqttSampleUsingQueue

MQTT communication based on a messages queue

2

IotMqttSampleUsingCallback

MQTT communication based on a callback method

3

IotMqttSampleTlsPsk

MQTT communication via a secure TLS connection and PSK (PreSharedKey)

4

IotMqttSampleTlsCa

MQTT communication via a secure TLS connection and CA (certificate authority) certificate

5

IotMqttSampleAwsIoT

MQTT communication with AWS IoT

6

IotMqttSampleAzureIotHub

MQTT communication with the Microsoft Azure IoT Hub

7

IotMqttSampleIbmWatsonIoT

MQTT communication with IBM Watson IoT

8

IotMqttSampleMathworksThingspeak

MQTT communication with the ThingSpeak IoT platform from MathWorks

9

IotMqttv5Sample

MQTTv5 communication based on a messages queue

10

IotMqttv5LastWillSample

Demonstrates the use of LastWill in interaction with the MQTTv5 function blocks.

11

IotMqttv5ReqResSample

Demonstrates the request/response mechanism of MQTTv5, as well as the handling of UserProperties and CorrelationData

12

IotMqttv5UserPropsSample

Demonstrates the use of user properties, which are part of MQTTv5.

13

JsonXmlSamples

Contains various samples demonstrating the use of the JSON/XML parsers from the PLC library Tc3_JsonXml.

Downloads

Sample code and configurations for this product can be obtained from the corresponding repository on GitHub: https://www.github.com/Beckhoff/TF6701_Samples. There you have the option to clone the repository or download a ZIP file containing the sample.

Samples 1: