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

写入串口

Created: November-22, 2018

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

% Write one byte
fwrite(s, 255);

% Write one 16-bit signed integer
fwrite(s, 32767, 'int16');

% Write an array of unsigned 8-bit integers
fwrite(s,[48 49 50],'uchar');

% Close the serial port
fclose(s);
  • 自动处理从串行端口接收的数据
  • 即使丢失或覆盖也会关闭串行端口

Copyright © 2018. All right reserved

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

  • 关于我们
  • 免责声明