4. On the Settings Editor tab, click the MQTT sub-tab.
a. Enable MQTT.
b. Enter the Broker URL. Enter test.mosquitto.org for this example.
c. Select Persistent for MQTT Connection type.
d. Enter 1883 for the Port Number.
e. Write down the MQTT Base Topic; it is case sensitive. By default it is cs/v1/.
f. Keep all other MQTT settings as their defaults.
5. Click Apply.
Program the data logger
Use MQTTPublishTable() within a DataTable/EndTable declaration to publish stored
data via MQTT. See the CRBasic Editor help for detailed instruction information and program
examples: https://help.campbellsci.com/crbasic/cr300/ .
DataTable(Five_Min,True,-1)
DataInterval(0,5,Min,10)
Average(1,Temp_C,FP2,False)
Minimum(1,BattV,FP2,False,False)
Publish every 5 min in CSJSON format. The last three
parameters are optional to specify longitude, latitude, and
altitude. Here we use NaN as placeholders for these values.
MQTTPublishTable(0,0,5,Min,1,NaN,NaN,NaN)
EndTable
19. Communications protocols123