logo
  • 教程列表
  • SO官方文档
  • 使用串口
    • 在 MacLinuxWindows 上创建串行端口
    • 选择通讯模式
    • 从串口读取
    • 即使丢失或覆盖也会关闭串行端口
    • 写入串口
    • 自动处理从串行端口接收的数据
  1. StackOverflow 文档
  2. MATLAB Language 教程
  3. 使用串口
  4. 从串口读取

从串口读取

Created: November-22, 2018

假设你在这个例子中创建了串口对象 s ,那么

% Read one byte
data = fread(s, 1);

% Read all the bytes, version 1
data = fread(s);

% Read all the bytes, version 2
data = fread(s, s.BytesAvailable);

% Close the serial port
fclose(s);
  • 即使丢失或覆盖也会关闭串行端口
  • 选择通讯模式

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明