Flag not resetting

I am using a trinket that sends a high/low signal to a teensy 3.2 to initiate another program running. If the teensy see's a HIGH the program will start running.

I can get the trinket to send the HIGH but for some reason can't get it to revert back to LOW after 1 second. I'm leaving 1 second just to ensure the signal isn't missed.

I know I am making a very basic mistake, but hoping someone can correct me.
Thanks

Trinket code:

//#define sensor A2; // GPIO digital pin #2 = A1
#define sensorPin 2 //pin2 = A1 ... type analogRead(1)
#define ledPin 1 //PWM on 0 1 4
#define sendPin 4
 
int startDuration = 3000;
int startScene = 0;
int startFlag = 0;

unsigned long startTime;
unsigned long prevTime;
unsigned long prevTime2;
unsigned long prevTime3 = 0;

int ledFastActive = 0; 

void setup() {
  pinMode(sensorPin, INPUT); //analog
  pinMode(ledPin, OUTPUT);   //analog
  pinMode(sendPin, OUTPUT); //send to teensy
  analogWrite(ledPin, 255);
  digitalWrite(sendPin, LOW);
}

void loop() {
  checkSensor(startScene);
  if (startScene == 1){
    digitalWrite(sendPin, HIGH);
    delay(1000);
    digitalWrite(sendPin, LOW);
    delay(1000);
  }
//  else {
//    digitalWrite(sendPin, LOW);
////    Serial.println("SendPin LOW");  
//  }

//  if ( (startScene == 0) && (digitalRead(sendPin) == 1) ) {
//    if ( (millis() - prevTime3) >= 1000) {
//       prevTime3 = 1000;
//       digitalWrite(sendPin, LOW);
//    }
//  }

}

int checkSensor(int result) {
//LED Pulse
  if (ledFastActive = 0) { // solid if sensor not triggered
    analogWrite(ledPin, 255);   
  }
  
  int distance = analogRead(1);
  int sampleDuration = 50;

  if ((distance >= 250) && (startFlag == 0)) { // if sensor covered, start timer
    startFlag = 1;
    prevTime = millis();
    prevTime2 = millis();

  }
  if ((startFlag == 1) && ((millis() - prevTime) >= sampleDuration) ) {  // keep sampling 10x/sec
    prevTime = prevTime + sampleDuration;
    distance = analogRead(1);
//    Serial.println("Sampling: Continue holding hand over sensor");

    //LED Pulse ACTIVE
    ledFastActive = 1;
    unsigned long now = millis();  
    int ledFastPeriod = 600;
    int val = 128 + 127 * cos(2 * PI / ledFastPeriod * now);  
    analogWrite(ledPin, val); 

    if (distance < 250) { // cancel
          startFlag = 0; // pin went low
          ledFastActive = 0;
          result = 0;
          prevTime = millis();
//          Serial.println("Hand moved away!");
          analogWrite(ledPin, 255);
          return result;
    }
    if ( ((millis() - prevTime2) >= startDuration) && (distance >= 250) ) { // TRIGGER
        result = 1;
        startFlag = 0;
        prevTime = millis(); //reset clock
        prevTime2 = millis(); //reset clock ??
        digitalWrite(sendPin, HIGH);
//        Serial.println("START MOTORS!");
        return result;
    }
  }
}

Listening program temp code:

void setup() {
pinMode(6, INPUT);
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT); 
}

void loop() {
int val = digitalRead(7);
if (val == 1){
  digitalWrite(LED_BUILTIN, HIGH);
  Serial.println("Val = 1");
}
else{
  digitalWrite(LED_BUILTIN, LOW);
  Serial.println(val);
}

}

Did you connect the grounds?

Yes, both are powered by the same source.

I would have expected adding the delay(1000) LOW delay(1000) would have blocked things but don't understand how it could go HIGH and then not reset.

I'm open to other suggestions on how to structure this too...simply need to send HIGH after the sensor has been held for 3 seconds, then reset that value to LOW.

Please post a complete wiring diagram (hand drawn, not Fritzing) with all the connections clearly labeled, and power/ground identified.

Thanks for your help. I think i can get by with the solution below. I trigger it HIGH in checkSensor then low in the main loop.

  checkSensor(startScene);
  delay(1000);
  
  if (startScene == 1){
    delay(1000);
  }

  digitalWrite(sendPin, LOW);