[Solved] Bench with counting capabilities

The last update is a little confusing -- I'm not sure what you're trying to accomplish there, but maybe I just need to read it a couple more times.

However, from the earlier attempts, I think maybe the problem is the lack of a suitable reference. You're comparing the value to the last reading + 200, which I assume is an arbitrary figure chosen to represent a big enough change in light to be considered a change in occupancy. But then you set the last reading to the current reading and sample again. So, in effect, your reference is constantly moving toward the current value. This is like automatic gain control with no feedback.

Also, the time it takes the Arduino to sample your inputs, write your results to serial, and return back to the beginning of the loop is very short. So, your sliding scale is going to slide very quickly.

What you need is a stable reference with which to compare.

You can dedicate a sensor to ambient light, but then what if someone sitting down casts a shadow on other seats? Maybe your unoccupied seats will be sufficiently below ambient to trigger a false positive.

You could use a calculated window to average the brightest the LDR has seen in the last ... say 30 minutes. But what if someone has been sitting for 45? You're back to where you are now, where the reference is no longer accurate.

Maybe what you need is to detect transitions. Sudden light-to-dark, or dark-to-light. Maybe you would need to sample every 1/4 second, and hold the last two seconds worth of samples. If the value now is significantly different from the value two seconds ago, act on it. Also, consider using percentages rather than a hard-coded value of 200. At night, the system will be worthless, but at least during the morning and evening, where the light may not be high enough to make a 200 unit difference, a change of 25% might still be useful.