Do you mean this:-
// pHRead.ino
// Constants:-
const byte pHpin = A0; // Connect the sensor's Po output to analogue pin 0.
// Variables:-
float Po;
void setup()
{
Serial.begin(115200);
}
void loop()
{
Po = 1023 - analogRead(pHpin); // Read and reverse the analogue input value from the pH sensor.
Po = map(Po, 0, 1023, 0, 14); // Map the '0 to 1023' result to '0 to 14'.
Serial.println(Po); // Print the result in the serial monitor.
delay(1000); // Take 1 reading per second.
}
Reverses the analog pin input reading from '1023 to 0' to '0 to 1023', maps it between 0 and 14, then prints it to the serial monitor.
An input of 511 is neutral and will return 7.
Edit: I should add that when writing this I was assuming that the range of the pH sensor is 14. I'm fairly sure that's right.
(And I made a silly mistake at first, but all fixed now. )