 const int outPinLed = 2;
 const int inPinTrigger = 7;
-const int inPinDetector = 4;
+const int inPinDetector = A0;
 
 int triggerPressed = 0;
+int detectorValue = 1023;
 
 void setup() {
   // put your setup code here, to run once:

  if (triggerPressed != triggerPrev) {
    Serial.print("Trigger state changed: ");
    Serial.println(triggerPressed);
    if (triggerPressed) {
      int detectorValue = digitalRead(inPinDetector);
      
      Serial.print("Detector: ");
      Serial.println(detectorValue);
    }
  }
    
  int ledState = triggerPressed ? HIGH : LOW;
  digitalWrite(outPinLed, ledState);


  pinMode(outPinLed, OUTPUT);
  digitalWrite(outPinLed, LOW);

  pinMode(inPinTrigger, INPUT_PULLUP);
}

void loop() {
