Main Content

UDP Receive

Receive UDP message on wired network

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

Library

Simulink Support Package for Arduino Hardware/Ethernet Shield

  • UDP Receive block

Description

Receive UDP messages on a local port. This block reads one data packet at a time.

Use this block when the transmission speed is of higher priority than the transmission reliability or the order of messages.

You can monitor the Status block output to verify that the data is received successfully.

The UDP Receive block has two outputs, Data and Status.

When data is available:

  • The Data block output emits data received from the UDP local port on the Arduino® board.

  • The Status block output emits 1.

When data is not available, the Status block output emits 0.

The Data block output emits uint8 values.

The Status block output emits int values.

During simulations without the hardware, this block emits zeroes.

Parameters

Local port

Enter the local port through which you want to receive the UDP messages. The local IP port numbers range from 0 to 65535.

Click View pin map to open the Arduino Pin Mapping table.

To know how to assign pins for the block, see Pin Mapping for Arduino Timer Independent Blocks.

Sample time

Specify how often this block reads the UDP messages, in seconds. Enter a value greater than zero. This value defaults to a sample time of 1 second.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.