How can I use the serialport command to read ASCII data from an M5Stick-C

5 ビュー (過去 30 日間)
Matt Kutcher
Matt Kutcher 2021 年 12 月 12 日
Hi! I am trying to read a stream of data from an M5Stick-C through the serial port. I am using the following command
device = serialport('COM4', 115200);
I have the M5Stick configured to display the data at one of its analog read pins on its LCD, so I can tell when data is being sent. Unfortunately, when I run that command in matlab, the M5Stick seems to freeze and the values no longer update on its screen. Then using the command
readline(device);
this error is thrown, "Warning: The specified amount of data was not returned within the Timeout period for 'readline'. 'serialport' unable to read any data. For more information on possible reasons, see serialport Read Warnings."
I have a terminating character configured as well and Im pretty sure all of the serial port setting are the same for both devices.
Is there any reason why createing a setting up the port in matlab has this effect? Note this does not happen when I used the outdated command
device = serial('COM4', 'BAUD', 115200);

回答 (0 件)

カテゴリ

Help Center および File ExchangeSerial and USB Communication についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by