#include<SoftwareSerial.h>SoftwareSerialmySerial(12,13); //Uno Rx Tx (12 13) = SoftwareSerialconstchar* Stream_mode ="M 00\r\n";String str;voidsetup() {Serial.begin(9600); //시리얼 통신 초기화Serial.println("SST GAS Sensor");mySerial.begin(9600);mySerial.print(Stream_mode);} voidloop() { /* Response ex) O XXX T XXX P XXX % XXX e xxx O XXX: PPO2 T XXX: temperature P XXX: barometric pressurec % XXX: O2 e XXX: Sensor Status */if(mySerial.available()>0) { str =""; str =mySerial.readStringUntil('\n'); Serial.println(str); }}
#include<SoftwareSerial.h>SoftwareSerialmySerial(12,13); //Uno Rx Tx (12 13) = SoftwareSerialconstchar* Poll_mode ="M 01\r\n";constchar* O2_Read ="%\r\n";String str;voidsetup() {Serial.begin(9600); //시리얼 통신 초기화mySerial.begin(9600);Serial.println("SST GAS Sensor");delay(1000);mySerial.print(Poll_mode);} voidloop() { /* Response ex) O XXX T XXX P XXX % XXX e xxx O XXX: PPO2 T XXX: temperature P XXX: barometric pressurec % XXX: O2 e XXX: Sensor Status */mySerial.print(O2_Read);delay(1000);if(mySerial.available()>0) { str =""; str =mySerial.readStringUntil('\n'); Serial.println(str); }}