#include <SoftwareSerial.h>
SoftwareSerial pH = SoftwareSerial(2, 3); //setup and rename soft uart.
// RX|TX
void setup(){
pH.begin(38400); //open pH comms
Serial.begin(38400); //open serial comms
}
void loop() {
pH.print("c");
pH.print("s");
pH.print((char)13);
delay(1000);
char inByte = '0';
while(pH.available() > 0)
{
Serial.print("pH_available: ");
Serial.println(pH.available());
inByte = pH.read();
Serial.println(inByte);
inByte = pH.read();
Serial.println(inByte);
inByte = pH.read();
Serial.println(inByte);
inByte = pH.read();
Serial.println(inByte);
inByte = pH.read();
Serial.println(inByte);
}
}
I got it to work with this code, the random numbers its pulling are referring to ASCII dec. I'm way noob though, so I don't know exactly why you have it reading each byte like that. I feel like something else might be better there... but like I said I'm very noob.
I also changed the If{} to a while{} which from my understanding is a newer way of doing this supported by v1.0. I'm here to learn too ![]()