Code covered by the MathWorks Limited License

Highlights from
Simulink Support Package for Arduino Uno and Mega 2560 hardware (R2012b)

image thumbnail
from Simulink Support Package for Arduino Uno and Mega 2560 hardware (R2012b) by MathWorks Simulink Team
Simulink block library for creating standalone applications for Arduino Uno and Mega 2560 platforms

Arduino Serial Receive :: Target for Use with Arduino Hardware (Target for Use with Arduino Hardware)

 

Arduino Serial Receive

Get one byte of data from serial port

Library

Target for Use with Arduino Hardware

Description

Get one byte of data from the specified serial port.

If data is not available, the block outputs -1.

Enter the number of the serial port. For Arduino Mega 2560, enter 0 - 3. For Arduino Uno, enter 0. One Serial Receive block using the same port is allowed in the model.

This block outputs the first byte of the incoming serial data on the specified serial Arduino port. Ports 0, 1, 2, and 3 are available.

The block operates in non-blocking fashion. If the data is not available, the block outputs -1.

One Serial Receive blocks using the same pin is allowed in the model.

This block uses the Serial.read function from the standard Arduino library.

Input Port: - V: inherited data type (internally converted to uint8)

If you run your model on target hardware, this block outputs actual data. If you simulate your model without running it on the target hardware, this block outputs zeroes. See TBD

Example

Get One Byte of Data from Serial Port

Use the Serial Receive block to get one byte of data from a serial port.

Install support for Arduino using the Target Installer, as described in TBD

(Perform the second step — TBD)

Dialog

Port Number

int (0-3); the range will be checked

Sample time

double

Specify how often the scheduler runs this block. Enter a value greater than zero. This value defaults to a sample time of 1 second.

External Web Sites

  


© 1984-2012 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments

Contact us