Measure nightsky with TSL237

GoForSmoke:

Corpze:
If i want to make ,say three measurements, and then take the median (freq1 + freq2 + freq3 / 3) ?

Operation order will screw that up. Only the last will be divided.

((freq1 + freq2 + freq3) / 3) is what you want, if that is really what you want to do **.

Extra parenthesis can't hurt unless they're in the wrong place or not balanced (as many opens as closes). If in doubt, use them. The compiler doesn't add code for extras.

**

Pulses: 10; Freq: 10869 Hz

If you averaged the 10 pulses as above, you would lose the last digit, have no rounding....

You could do something like (untested pseudo code alert!) this for rounding

samples = 3 // could be 10 for instance

freq = ((freq1 + freq2 + freq3 + samples / 2) / samples)

I will try that, but what about the frequency, why can´t it go any lower than 10869 Hz? I haven´t calibrated the ZP yet, can it be the problem?