ArduinoIDE의 직렬 플로터로 2개 이상의 데이터 표시
7152 단어 전자 공작ArduinoArduinoIDE
ArduinoIDE의 시리얼 플로터를 아십니까?
Arduino 1.6.6 당으로 붙여진 기능이라고 하고, 숫자를 시리얼로 흘리면, 그 그래프를 써 주는 기능입니다. 그래프의 스케일도 어느 정도 자동적으로 변경해 주기 때문에, 일단 센서로 계측한 숫자를 리얼타임으로 보고 싶다고 때에 매우 편리!
이런 식으로 그래프가 표시됩니다.

단일 데이터 그래프를 작성하는 방법
간단하고 시리얼 통신으로 「숫자(개행)」를 보내는 것뿐입니다. 예를 들면 이런 스케치입니다.
이 스케치에서 이전 그래프를 그립니다.
serial-plot1.inodouble angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.println("");
delay(50);
}
Arduino UNO에 쓰고 도구 > 시리얼 플로터를 선택합니다.


두 데이터의 그래프를 작성하는 방법
serial-plot2.inodouble angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.println("");
delay(50);
}
이런 식으로 쉼표로 구분하여 데이터를 보내면 ...

두 개의 그래프를 동시에 작성할 수 있습니다.
오른쪽 상단에있는 범례? 왼쪽부터 순서대로 색상이 할당됩니다.
제1항목: 파랑
두 번째 항목: 오렌지
이미 이해할 수 있지만 3 개의 데이터 그래프를 작성하는 방법
serial-plot3.inodouble angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.print(",");
Serial.print(2 * cos(angle / 180 * PI));
Serial.println("");
delay(50);
}

이런 식으로 세 번째 항목이 빨간색으로 플로팅됩니다.
Y축의 스케일이 하나밖에 없는 것에 주의가 필요합니다만(1만 부근을 우로쵸로하는 데이터와, 0 부근을 우로쵸로하는 데이터를 함께 쓰면 직선으로 밖에 보이지 않거나・・・), 간단하게 센서의 값을 확인할 수 있으니 꼭 활용하면 어떨까요?
끝까지 읽어 주셔서 감사합니다.
Reference
이 문제에 관하여(ArduinoIDE의 직렬 플로터로 2개 이상의 데이터 표시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/azusa9/items/79af5c4c0f75c6c57694
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
간단하고 시리얼 통신으로 「숫자(개행)」를 보내는 것뿐입니다. 예를 들면 이런 스케치입니다.
이 스케치에서 이전 그래프를 그립니다.
serial-plot1.ino
double angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.println("");
delay(50);
}
Arduino UNO에 쓰고 도구 > 시리얼 플로터를 선택합니다.


두 데이터의 그래프를 작성하는 방법
serial-plot2.inodouble angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.println("");
delay(50);
}
이런 식으로 쉼표로 구분하여 데이터를 보내면 ...

두 개의 그래프를 동시에 작성할 수 있습니다.
오른쪽 상단에있는 범례? 왼쪽부터 순서대로 색상이 할당됩니다.
제1항목: 파랑
두 번째 항목: 오렌지
이미 이해할 수 있지만 3 개의 데이터 그래프를 작성하는 방법
serial-plot3.inodouble angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.print(",");
Serial.print(2 * cos(angle / 180 * PI));
Serial.println("");
delay(50);
}

이런 식으로 세 번째 항목이 빨간색으로 플로팅됩니다.
Y축의 스케일이 하나밖에 없는 것에 주의가 필요합니다만(1만 부근을 우로쵸로하는 데이터와, 0 부근을 우로쵸로하는 데이터를 함께 쓰면 직선으로 밖에 보이지 않거나・・・), 간단하게 센서의 값을 확인할 수 있으니 꼭 활용하면 어떨까요?
끝까지 읽어 주셔서 감사합니다.
Reference
이 문제에 관하여(ArduinoIDE의 직렬 플로터로 2개 이상의 데이터 표시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/azusa9/items/79af5c4c0f75c6c57694
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
double angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.println("");
delay(50);
}
serial-plot3.ino
double angle = 0;
void setup() {
Serial.begin(250000);
}
void loop() {
angle++;
Serial.print(sin(angle / 180 * PI));
Serial.print(",");
Serial.print(sin(angle + 30 / 180 * PI));
Serial.print(",");
Serial.print(2 * cos(angle / 180 * PI));
Serial.println("");
delay(50);
}

이런 식으로 세 번째 항목이 빨간색으로 플로팅됩니다.
Y축의 스케일이 하나밖에 없는 것에 주의가 필요합니다만(1만 부근을 우로쵸로하는 데이터와, 0 부근을 우로쵸로하는 데이터를 함께 쓰면 직선으로 밖에 보이지 않거나・・・), 간단하게 센서의 값을 확인할 수 있으니 꼭 활용하면 어떨까요?
끝까지 읽어 주셔서 감사합니다.
Reference
이 문제에 관하여(ArduinoIDE의 직렬 플로터로 2개 이상의 데이터 표시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/azusa9/items/79af5c4c0f75c6c57694텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)