Please enable JavaScript to view this site.

Waijung 2 User Guide

Navigation: ESP32 target > Block references > IOT

HTTP client block

Scroll Prev Top Next More

How this block appears in a Simulink model?

http_client_block_1
http_client_block_2

What can be configured?

POST request

http_client_block_3

GET request

http_client_block_4

 

Configuration Parameter

Selectable Option/Value

Description

HTTP Method

GET--POST

Specify the request type

Response buffer size

32--64--128--256--512--1024--2048--4096

Select the response buffer size

Enable semaphore control for HTTP block

Check--Uncheck

Having multiple HTTP blocks in the same model file can cause errors during run time. In such case this parameter should be enabled.

Input method

From input port-- From circular buffer

Specify the Input method of input message for the POST method

Sample time (sec)

-1 (inherited) or specify

Specify sample time for the block

HTTP Method: POST

Port Name

Port Type

Date Type

Description

URL

Vector

uint8

URL of the destination server the data to be transmitted

POST Data

Scalar/Vector

uint8

Data which is to be transmitted

HTTP response code

Vector

uint8

HTTP response status codes indicate whether a specific HTTP request has been successfully completed

Response data

Scalar/Vector

uint8

Data receive by the server

HTTP Method: GET

Port Name

Port Type

Date Type

Description

URL

Vector

uint8

URL of the destination server the data to be transmitted

HTTP response code

Vector

uint8

HTTP response status codes indicate whether a specific HTTP request has been successfully completed

Response data

Scalar/Vector

uint8

Data receive by the server

When to use this block?

This block can be used to send GET or POST HTTP requests.

Demo

Demo file : esp32_http_client_demo.slx

The full model

http_client_block_5

 

The GET request subsystem

http_client_block_6

 

The POST request subsystem

http_client_block_7

Description

This example will demonstrate how to use the WiFi block to initialize the WiFi in station mode and send the GET and POST requests to the web servers using HTTP client block via the internet. This uses a Echoserver to test the HTTP Client Block.

so a HTTP client block can send a message to the server and the server can receive the message and send, or echo, it back to the HTTP client block.

Note:

Please insert valid SSID and Password to the WiFi setup block.

The serial monitor used for this application is the Putty software which is open source application.

Baud Rate: 115200

What should be happening?

Use a serial communication monitor software to test this demo. Select the correct COM port in the software to monitor the data. The GET and POST response data will be shown in the host PC as below

http_client_block_8

Copyright 2024 Aimagin Co.,Ltd. Rev.1659