const int PD_PIN = A0;
const int LED_PIN = 9;
const int THRESH = 30; // tune after testing (0-1023)

void setup() {
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int v = analogRead(PD_PIN);
  Serial.println(v);
  if (v >= THRESH) {      // lower = more IR light (photodiode conducting)
    digitalWrite(LED_PIN, HIGH);
  } else {
    digitalWrite(LED_PIN, LOW);
  }
  delay(100);
}
