modulation with millis

    if (analogRead (ledPin) == 0) 
        analogWrite(ledPin, 255);  
    else          
      analogWrite(ledPin, 0);

The analogRead() function only works on the analog pins. The analogWrite() function only works on some digital pins. There is no way you can use both functions on the same pin in any kind of meaningful way.