// Use this project to run precompiled AnnexBasic binary:
// Press "F1", choose "Load HEX File and Start Simulation..."
// Select a precompiled AnnexBasic binary.
// copy this script in the editor page, save and run it
' MQTT SSL test program
' Using mosquitto test server
I2C.SETUP 26, 25
LCD.INIT &h27, 16, 2
onmqtt mqtt_msg
print mqtt.setup("mqtt://test.mosquitto.org", 1)
print mqtt.connect("", "") ' No login / pass required
print mqtt.subscribe("/AnnexTest") ' subscribe to the topic /AnnexTest
for z = 1 to 10
' send messages to the topic /AnnexTest
print mqtt.publish("/AnnexTest", "Annex"+str$(z))
pause 100
next z
print ramfree
wait
' receive messages from the server
mqtt_msg:
print "TOPIC : "; mqtt.topic$
print "MESSAGE: "; mqtt.message$
LCD.print 1,1, left$(mqtt.topic$ + string$(16, " "),16)
LCD.print 1,2, left$(mqtt.message$ + string$(16, " "),16)
return
'// use the web client mqtt.run using
'// test.mosquitto.org as server
'// 8081 as port
'// /AnnexTest as Topic