Code Monkey home page Code Monkey logo

mqtt_library's Introduction

MQTT_Library

MQTT library running on Renesas RX65N chip

This code is an MQTT library file,

Hardware platforms such as Renesas RX65N, ESP8266, etc

Use the AT command to enable ESP8266 to enter TCP transparent mode, and package it into MQTT library files in C language to drive ESP8266 to achieve publish/subscribe functionality

Step 1: Initialize hardware Step 2: Access the router, make the ESP8266 access the Internet, and access the MQTT Broker Step 3: Send AT command to put ESP8266 into TCP transparent transmission mode Step 4: Send MQTT CONNECT message and connect to MQTT Broker Step 4: If MQTT Broker access is successful, send an MQTT Subscription message to subscribe to the topic Step 5: If the subscription is successful, we can use the MQTT client to send messages to the topics subscribed to by ESP8266, and ESP8266 can receive messages from the MQTT client Step 6: We can send messages to the MQTT client by sending an MQTT Publish message Step 7: In order to maintain a long connection between MQTT and Broker, we must send heartbeat packets at a scheduled time, with a timer cycle of 60 seconds

Program API interface description:

input client_id, client id, which depends on the MQTT Broker server input username, username, depending on the MQTT Broker server return void : return empty

Note: If the connection is successful, a message of 20 02 00 00 00 bytes will be returned. We can determine whether the receiving area contains this message to modify the connection status of MQTT,

void mqtt_connect(uint8_t *client_id, uint8_t *username, uint8_t *password)

input the topic subscribed to by topicname input QoS message level, only subscription topics with level 0 are implemented in the code

receiveeturn void and return empty

void mqtt_subscribe(uint8_t *topic_name, uint8_t Qos)

input the topic published by the topic input the content published by msg return void: return empty

void MQTT_PublishQs0(uint8_t *topic, uint8_t *msg)

Program Run Block Diagram

mqtt_library's People

Contributors

mintin avatar martinmengx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.