参考文章:串口波形显示软件SerialChart的使用-CSDN博客
下载地址:SerialChart – Starlino Electronics
arduino代码如下
// 定义LED引脚,这里假设是13号引脚 const int ledPin = 13; void setup() { // 初始化LED引脚为输出模式 pinMode(ledPin, OUTPUT); // 初始化串口通信,设置波特率为9600 Serial.begin(9600); } void loop() { // 切换LED状态 digitalWrite(ledPin, !digitalRead(ledPin)); // // 打印0到499的数字 // for(int ch1 = 0; ch1 < 500; ch1++) { // Serial.println(ch1); // } // 循环打印ch1, ch2, ch3, ch4的值,直到它们分别达到50, 150, 250, 350 int ch1 = 0, ch2 = 100, ch3 = 200, ch4 = 300; while(ch1 < 50 && ch2 < 150 && ch3 < 250 && ch4 < 350) { Serial.print(ch1); Serial.print(","); Serial.print(ch2); Serial.print(","); Serial.print(ch3); Serial.print(","); Serial.println(ch4); ch1++; ch2++; ch3++; ch4++; } // 延时200毫秒 delay(200); }
serial chart配置如下
[_setup_] port=COM10 baudrate=9600 width=2000 height=200 background_color=white grid_h_origin=100 grid_w_step=10 grid_h_color=#EEE grid_h_origin_color=#CCC grid_v_origin=100 grid_v_step=10 grid_v_color=#EEE grid_v_origin_color=transparent [_default_] min=-20 max=500 [ch1] color=green [ch2] color=yellow [ch3] color=blue [ch4] color=red
效果如下
标签:arduino,color,chart,ch1,ch2,grid,串口,print,Serial From: https://www.cnblogs.com/dogingate/p/18554711