"CES191" humidity sensor [solved]

UKHeliBob:
The idea looks OK but

1 - you don't need to count both the HIGH and LOW states
2 - do any calculations at the end of the period
3 - you should really count when the input becomes HIGH rather than when it is HIGH
4 - why are you printing state ?

1- if i just count the HIGH states, the code should be:
ratio = hightstate / (total)
the total should be the frequency of the arduino processor?

2- I've put the ration calculation in the if clause.
3- i hope that you tell me how to do that.
4- i should print the ration and note the state, it was a mistake, thanks.

when i print the lowstate+highstate i get strange numbers (screenshot attached)