我怎么等着看arduino灯闪了多少次?

How can I wait to see how many times the light flashes with arduino?

我知道这看起来像是一个随机问题,基本上我在电路中设置了一个光敏电阻,以便它检测光。我有一个激光会闪烁不同的时间来发出信号,假设闪烁 1/2 秒,然后闪烁 1 秒 = a.

我怎样才能等待并检测到这个,如果这没有意义,抱歉...

此函数将return激光模块射向光敏电阻的时间量(以毫秒为单位):

int photo_resistor_time()
{
    int i = 0;
    while (photo_resistor_value > 100)
    {
        i++;
        Delay(1);
    }
    return i;
}