Converting a Photo Resistor circuit code to a Salinity Sensor one

Hi guys,
I am doing a Salinity Sensor project. However, I am using a photoresistor circuit, together with its corresponding code as shown below; How do I make this code read my Salinity sensor resistance as a measure of voltage and display values as it reads through on the serial monitor.
The Url included below are images that represent my circuit exactly, except that the f5and f6 on the breadboard are connected to my salinity sensor, rather than to the photoresistor.
Thanks

Code:

const int sensorPin = 0;
const int ledPin = 9;
int lightLevel, high = 0, low = 1023;
void setup()
{
pinMode(ledPin, OUTPUT);
}

void loop()
{

lightLevel = analogRead(sensorPin);

manualTune(); // manually change the range from light to dark

analogWrite(ledPin, lightLevel);

}

void manualTune()
{

lightLevel = map(lightLevel, 0, 1023, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);

}

void autoTune()
{

if (lightLevel < low)
{
low = lightLevel;
}

if (lightLevel > high)
{
high = lightLevel;
}

lightLevel = map(lightLevel, low+30, high-30, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);

}

well you need to add Serial.begin(115200); in the setup() to open up the communication with your computer (at 115200 bauds, set that in the serial console)

and then in your loop()

just add a Serial.print(lightLevel); before or after you adjusted it.

By the way in the code

  lightLevel = map(lightLevel, 0, 1023, 0, 255);
  lightLevel = constrain(lightLevel, 0, 255);

the second line is useless since lightLevel comes from an analogRead so on your platform is guaranteed to be between 0 and 1023.

Thanks so much J-M-L
I can see the real time data being plotted

In the code above, there is manual tune and Autotune

Do u know if only one of them is required or both?
Thanks

you don't need it. your code could just be

const int sensorPin = 0; // pin A0
const int ledPin = 9; // light - ensure there is proper current limiting resistor

void setup()
{
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  int sensorLevel = analogRead(sensorPin);
  Serial.print("Sensor Value = "); Serial.println(sensorLevel); // sensorLevel between 0 and 1023
  sensorLevel = map(sensorLevel, 0, 1023, 0, 255); // this is to convert sensorLevel from 0-1023 to 0-255
  analogWrite(ledPin, sensorLevel); // to set the light brightness because it needs a value between 0 and 255
}