Long Short detector

Hi guys,

I'm trying to make a code that detects long light signals and short ones.
Although I'm struggling with finding the right code for this.
(i'm working with a light sensor)
Could someone help me out?
Thank you in advance

int pin = 7;
unsigned long duration;

void setup()
{
  pinMode(pin, INPUT);
}

void loop()
{
  duration = pulseIn(pin, HIGH);
}

Although I'm struggling with finding the right code for this.

The code you posted does something. You did not way what it does. Which, pf course, is reasonable because you haven't a clue what it actually does, since there are no Serial.print() statements in it.

It is unreasonable, though, that there are no Serial.print() statements.

You expect the code to do something, although you kept those expectations to yourself.

We can't help you make the code's actual behavior match your expectations, based on the data we have so far.

Elsa123:
Could someone help me out?

How short is "short"?

How long is "long"?

Are we talking about 1 second as short and 30 seconds as long?

Or maybe 1 millisecond as short and 5000 milliseconds as long?
Please send more information!

Which light sensor are you using?

circuit schematics?