Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

Arduino UDP Receive

Receive UDP message

Library

Simulink Support Package for Arduino Hardware/Ethernet Shield

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 Arduino Ethernet Shield uses the following pins on different Arduino board variants.

  • Arduino Mega 2560 – pins 50 to 53.

  • Arduino Uno – pins 10 to 13.

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 Data block output emits the last received value.

  • 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. See Block Produces Zeros or Does Nothing in Simulation

Dialog Box

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.

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. The minimum value is 0.000001 second.

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

    Note:   To change the Target hardware parameter, select Tools > Run on Target Hardware > Options.

See Also

| |

External Web Sites

Was this topic helpful?