Kindly help->Reading applied voltages across a segment of polymer display

Hello everyone
The problem is: I need to read voltages across a segment of a polymer display.

Some info about segment: There are two electrodes counter electrode (CE) and pixel electrode (PE). To change color from white to blue, need to apply 2-3 volts on counter electrode (CE) and 0 v on PE for enough time. similarly in order to make segment from blue to white need to apply 2-3 volts on PE and 0 v on CE. But by supplying these voltages some charge get developed across the segment and if you remove the battery and measure the voltages across the segment it shows 1.2 V for blue color and -1.9 v for white color. For measuring 1.2 v I am using an analog port which is connected at the same point where CE is connected to digital port 3. I implemented this by supplying 2.5 volts through a voltage divider as shown in attached figure. By making the digital port 3 as input it means it will no more supply any voltages to the segment and meanwhile I am measuring 1.2 v and printing on serial monitor. But the problem is it does not show 1.2 v but 0.13 v instead. Can anyone help with that?
I have arduino mega2560.

int PEA = A8;
int PE = 2; // PE:Pixel electrode of segment
int CE = 3; // CE: counter electrode of segment
int temp_val_PE = 0;
float val_PE;


void setup()
{
  Serial.begin(9600);
  pinMode(PE,OUTPUT);
  pinMode(CE,OUTPUT);
  Serial.println("PE Val");

}

void loop()
{
  analogWrite(CE,0); // for white color
  analogWrite(PE,255);
  delay(1000);
  analogWrite(CE,255); //for blue color
  analogWrite(PE,0);
  delay(3000);
  pinMode(CE,INPUT);
  pinMode(PE,INPUT);
  temp_val_PE = analogRead(A8);
  val_PE = temp_val_PE * (5.0 / 1023.0);
  Serial.println("");
  Serial.println(val_PE);
  delay(10);
}

Thanks for reading the problem.

If I understand you correctly, you are saying that when you switch the PE or CE pin from OUTPUT to INPUT you lose the "bias" voltage and thus it does not work?
If that is what you mean (and I see that you are indeed using the same pins for input and output) why not try:

pinMode(CE,INPUT_PULLUP);
pinMode(PE,INPUT_PULLUP);

Keep in mind however that your voltage divider will load the internal pullup resistors so you may have to compensate for that.
You may also have to juggle the input and output modes as you describe the electrodes as needing a "high" on CE or PE and a "low" on the other electrode depending on the colour you want.

Thanks bro. I really appreciate your efforts. yes it works.thanks a lot.

Glad it's working.