AtTiny analog read always 1023 I am trying to replicate Low power LED firefly project. So what I'm trying to do is to do an analog read from a LED, to detect light. To simplify it a bit, I am using different pins and different leds for IN and OUT. The code:

#define PIN1 don't use this pin! /*this is RESET*/
#define PIN2 3
#define PIN3 4
#define PIN4 don't use this pin! /*this is GND*/
#define PIN5 0
#define PIN6 1
#define PIN7 2
#define PIN8 don't use this pin! /*this is VCC*/
#define ANL1 PIN7
#define ANL2 PIN3
#define ANL3 PIN2

// the setup function runs once when you press reset or power the board
void setup() {
  digitalWrite(PIN3, LOW); 
  pinMode(PIN3, INPUT);
}

#define BLINK true
// the loop function runs over and over again forever
void loop() {

  const int value = analogRead(PIN3);
  if(value&gt;=1023) {
    pinMode(PIN2, OUTPUT);
    digitalWrite(PIN2, HIGH); 
    delay(500);
    digitalWrite(PIN2, LOW); 
    delay(3);
  }
  else {
    delay(1);
  }
}


This is the setup. I am using much smaller resistor, but I'm still getting 1023 on analog read, as indicated by the output led always being on:







simulate this circuit &ndash; Schematic created using CircuitLab

What's wrong?
In this article the following steps are used when using an LED as a light detector:


Light up the LED by making the anode positive (logic one) and the
cathode negative (logic zero) - this fully discharges the LED as a
capacitor.
Charge up the capacitor by making the anode negative and the cathode
positive, as this is a small capacitor it will take no time at all
in other words for as short a time as you can.
Put the diode into the measurement mode, by making the anode
negative (it already is) and the cathode connected to an analogue
input.
Make a measurement of the analogue voltage, this is a reference
level to be used later.
Wait while the photon current is integrated - the longer the more
sensitive but too long and effects other than photo current
dominate.
Measure the voltage again and subtract it from the reference value
you took before the integration time. This figure is your light
reading.


Looking at the code in the above question it is not apparent where you switch from forward bias to revers bias.  Also, it does not appear there are two samples taken and the difference between the two samples is found.