Your code is very confusing because it is creating local variables called inByte all over the place. And it is not using .listen() to change the serial inputs
Try this version
#include <SoftwareSerial.h>
SoftwareSerial MPPT(3, 5); //Naming Pins And Input
SoftwareSerial BMV(6, 9); //Naming Pins And Input
const int threshold = 800; // Tells when to change state
byte ssByte; // for the bytes that come via SoftwareSerial
byte pcByte; // for the bytes that come from the PC
void setup() {
// initialize both serial ports:
Serial.begin(19200);
MPPT.begin(19200); // RX 3 TX 5
BMV.begin(19200); // RX 6 TX 9
}
void loop() {
int analogValue = analogRead(A0);
// read from port 1, send to port 0:
if (analogValue > threshold) {
MPPT.listen();
}
else {
BMV.listen();
}
if (MPPT.available()) {
ssByte = MPPT.read();
Serial.write(ssByte);
}
else if (BMV.available()) {
ssByte = BMV.read();
Serial.write(ssByte);
}
if (Serial.available()) {
pcByte = Serial.read();
if (MPPT.isListening()) {
MPPT.write(pcByte);
}
else if (BMV.isListening()) {
BMV.write(pcByte);
}
}
}
...R