I'm working on an algorithm that counts blinks of a LED. I have series of non-neagtive integers. They represent brightness of a LED in time. I give you two examples of these integer series below. Visually it's very obvious that LED blinked 7 times in example 1 and 8 times in example 2. But how can this be calculated by a computer. Any ideas? I don't even know if I'm asking this question on the right site. I'm new to this stuff but any help would be appreaciated.
Example 1: Data of Example 1
Example 2: Data of Example 2