Problem: I have a digital input connected to a digital sensor, that of course sends 0/1.
I need to check that, in 30 seconds, there has been at least one 1.
How would you do that?
It depends on how short the pulses from the sensor are. If it can send very short pulses and you don't want to miss any, polling the pin in software is not the right solution - monitoring the pin via an interrupt (pins 2 and 3 only) or using a counter is the right way.
If the pulses are long and you can guarantee to poll with digitalRead() often enough then this is a simpler solution. pulseIn() works nicely if you don't have any other task to perform while waiting.
Another approach is to add some extra hardware to stretch or latch the pulses you are looking for, so the software doesn't have to work so hard.