Wolfram Language

Transmit and Receive Serial Data

Many microcontrollers have one or more Universal Asynchronous Receiver/Transmitter (UART) modules for serial communication. This enables a microcontroller to communicate with another over the receive (RX) and transmit (TX) lines at a specified baud rate. It can also communicate with a computer though its USB port by the readily available USB-to-serial converters.

show complete Wolfram Language input

In this example, a continuously varying parameter is sent to an Arduino Uno as a serial input. The microcontroller will use this input to compute the coordinates for a Lissajous curve and send them back over serial. These values can then be used to dynamically plot the curve.

The model with the curve's coordinates.

The microcontroller specification.

Deploy the code.

Open a connection to the device.

Submit a scheduled task to send and receive data.

Parse and plot the data.

show complete Wolfram Language input

Remove the task and close the device after some time.

Related Examples

ja