Measure nightsky with TSL237

@GoForSmoke, 10,000 pulses?!. This would take a whole life if the site is dark. The TSL237 generates generates pulses of frequencies as low as ~0.15Hz in dark skies (even lower if you use filters). That's more than 6 seconds of period, so integrating 10,000 cycles seems a bad idea.

The best approach I think is to measure first one single pulse and decide (at runtime) if you want to count frequencies (or a great amount of pulses to promediate, as GoForSmoke suggested) or you need an alternative way to get the frequency.

Corpze, the SQM is cheap for what it does. If you take into account that those instruments need filters to cut the IR and narrow the spectral sensibility, needs some kind of optics to narrow the FoV, needs a case, an LCD, a board ... you end (in the arduino road) with an instrument that is nearly as expensive as the SQM (or even more!) and probably not as accurate (at least if you don't know what you do/need), trust me. And then, you need to calibrate the device.

If you want to build it just for learning purposes or something else, I think you need to return to the basics and stop trying to get inmediate results. I've been researching on this topic for months and I haven't found any library that just do what you want, sorry.

Just my two cents.