Control sending frequency for serial communication

1 view (last 30 days)
I am trying to read/write data from an arduino over serial using Simulink. I am sending two floats down (as sin waves for now) and echoing them back to valdiate my communication is working. However I seem to be having a problem with overriding the serial buffer by writting to fast.
My question is can you control the writing rate in simulink so that is only sends a messsage over xx ms or maybe only write when simulink gets a reply message?
Here is my simulink model
THis is the responce I am getting back:
One of the sine waves is very noise. I think that his has to do with the control rate. I am sending values to fast and the arduino cannot keep up.
How can I slow down the rate at which message are being send over the Serial bus? This is just a simple example, i plan on incooperating this into my controller down the line.

Answers (0)

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!