Hello! I created a TX and an RX with SoftwareSerial. Now I explain my project a little bit. It consists of a pH meter and a thermocouple. The thermocouple is type K and is connected to an Adafruit MAX 31856 plate, which in turn goes to the Arduino NANO to ports 13,12,11,10. Until there everything is correct and reads without problem. Now the story comes. The pH meter is connected to an EZO board (it is the brand) and has an RX and TX output, which goes to the Arduino to its respective RX TX. The story is that I have created the Rx Tx and I have assigned it the D6 and D7. I have called it Serial3, and I want it to read and send what it has read through that port and show it to me on the screen. And when I simulate I can not read the value well. I leave the code to see if you can help me out. Thank you very much to everyone in advance.
#include <Adafruit_MAX31856.h>
#include <SoftwareSerial.h>
Adafruit_MAX31856 max_A = Adafruit_MAX31856(10, 11, 12, 13);
String termoparstring_A = "";
String sensorstring = "";
String inputstring = "";
#define rxPin 7
#define txPin 6
SoftwareSerial Serial3 (rxPin,txPin);
boolean input_string_complete = false;
boolean sensor_string_complete = false;
void setup() {
Serial.begin(9600);
pinMode(rxPin,INPUT);
pinMode(txPin,OUTPUT);
Serial3.begin(9600);
inputstring.reserve(30);
sensorstring.reserve(60);
max_A.begin();
max_A.setThermocoupleType(MAX31856_TCTYPE_K);
}
void serialEvent() {
inputstring = Serial.readStringUntil(13);
input_string_complete = true;
}
void serialEvent3(){
Serial3.listen();
while (Serial3.available() > 0) {
char sensorstring = Serial3.read();
sensor_string_complete = true;
}
}
void loop() {
termoparstring_A =(max_A.readThermocoupleTemperature());
sensorstring = Serial3.read();
Serial.println(termoparstring_A);
Serial.println(sensorstring);
delay(500);
sensorstring = "";
sensor_string_complete = false;
}