5 Running the Example

  1. Create a new project in MPLAB® X IDE (for ex: ATmega4808)
  2. Open MCC by clicking Tools→ Embedded→ MPLAB® Code Configurator or click on the MCC icon
  3. In the Device Resources panel under Libraries dropdown select MQTT
  4. Check below for the Notifications [MCC] tab.
  5. Resolve the notifications step by step. In GUI select:
    • Scheduler Service: Foundation Services Timeout Driver
    • Transport Service: Wireless [WINC15XX]
    • Check the Generate Example box
  6. Configure dependent Libraries. For example
    • If Wireless [WINC15XX] library is selected configure: WINC Library ->SSID, Authentication, Password
    • If Wired TCPIPLite library is selected configure TCP/IP Lite Library
  7. Configure MQTT Library GUI. For example:
    • Host Address: mqtt broker address
    • Publish Topic: publish topic
  8. The tooltips
    provide additional information for each MQTT UI option
  9. Click Generate button
  10. Build the firmware and program the hardware.
  11. Connect to MQTT Server to observe the data being published by the hardware which acts as the MQTT Client.
  12. Connect another MQTT Client on the same broker and subscribe to a topic to receive the messages published over that topic.