Arduino IDE 2 串口绘图仪(Serial Plotter) 您所在的位置:网站首页 绘图仪操作视频 Arduino IDE 2 串口绘图仪(Serial Plotter)

Arduino IDE 2 串口绘图仪(Serial Plotter)

#Arduino IDE 2 串口绘图仪(Serial Plotter)| 来源: 网络整理| 查看: 265

简介

Arduino IDE 2.x是基于Thiea IDE开发的, 支持 VS Code 扩展。

Arduino IDE 1.x绘图仪是直接打开串口接收,所以串口接收器和串口绘图仪无法同时打开。而在2.0以后使用了websocket通讯将数据发送给pollter,所以两个界面可以同时打开(架构如下),每启动一个IDE都会创建一个websocket服务器的端口。

arduino.drawio

绘图仪源码分析

源码地址

https://github.com/arduino/arduino-serial-plotter-webapp.git

源码下载后可以通过以下命令运行

npm install npm test npm start npm build

http://localhost:3000 可以打开串口绘图仪

image-20230406203741325

重启会减少查找到listening的端口号, 工具netstat -ano | findstr 进程号

在App.tsx文件中, wsport: parseInt(urlParans.get(“wsPort”) || “xxx”), xxx 端口号可以通过```netstat -ano | findstr Arduino进程号``找到并修改。

image-20230404070937307

image-20230404065526911

绘图仪显示通过chart.js一个图表库进行绘图显示,如果需要可以修改其设置,最多的需求是修改横轴的显示个数,具体在ChartPlotter.tsx文件中,修改dataPointThreshold值。

image-20230404071122964 固定y轴,及其范围 在这里插入图片描述

直接修改Arduino中的绘图仪模块

绘图仪模块的位置在安装目录下

resources\app\node_modules\arduino-serial-plotter-webapp\build\static\js\main.xxxx.chunk.js

全局搜索 Object(o.useState)(50) ,这里的50指的是横坐标显示数值的个数

在这里插入图片描述



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有