Main Content

WiFi UDP Send

Send data to UDP host on wireless network

Add-On Required: This feature requires the Simulink Support Package for Arduino Hardware add-on.

  • WiFi UDP Send block

Libraries:
Simulink Support Package for Arduino Hardware / WiFi

Description

The WiFi UDP Send block sends data to a UDP host over a wireless network. The block sends data from the port number specified in the Local IP Port parameter. Specify the IP address and the port number of the receiving host in the Remote IP address and the Remote IP Port parameters.

You can run a Simulink® model containing WiFi UDP Send block in Connected IO mode on Arduino® boards.

For more information about the fixed ports and the allocated pins for the block, see Pin Mapping for Arduino Timer Independent Blocks.

Note

If you are having trouble using UDP to communicate with a computer, antivirus or firewall software might be blocking UDP traffic. If so, configure the software to allow the traffic for a specific IP port number.

Supported Hardware

You can use the WiFi UDP Send block only with the following hardware:

  • ESP8266

  • WiFi Shield

  • MKR1000

  • MKR WIFI 1010

  • Nano 33 IoT

  • Arduino compatible ESP32 – WROOM board

  • Arduino compatible ESP32 – WROVER board

Limitations

  • When using ESP8266 hardware, a model can have only one WiFi TCP Receive, WiFi TCP Send, WiFi UDP Receive, or WiFi UDP Send block.

  • The maximum number of connections allowed for different ports on WiFi UDP Receive blocks and WiFi UDP Send blocks in a model is two for WiFi shield, four for MKR1000, and one for ESP8266. If the model uses External mode over Wi-Fi® or includes a WiFi ThingSpeak Read block or WiFi ThingSpeak Write block, one UDP port is reserved for each from the maximum allowed connections.

Ports

Input

expand all

The block accepts data as an N-by-1 array. The block sends this data over a wireless network to the receiving host. The data is sent in little-endian format. To convert it to a big-endian format, do any of the following:

The maximum number of bytes that can be sent by this block at each time step is shown in the table.

Target Hardware

ESP8266

WiFi Shield

MKR1000

Maximum Number of Sent Bytes

2048641400

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

Parameters

expand all

Specify the remote IP address of the host to which the data is sent. To broadcast data to all the receiving hosts, specify 255.255.255.255.

Specify the port number of the application on the host to which data is sent. Match the remote port number with the local port number on the receiving host.

Specify the port number of the application on the target from which data is sent.

Version History

Introduced in R2014a