Terry has designed broadcast stations, recording studios, broadcast equipment, intelligent machines and special computer languages for IBM, and has worked as a broadcast journalist covering elections, fires, riots and Woodstock.
He has taught electronics

You're comparing two analog values, which could fluctuate by some units. If the test is done "fast", you can have flickering.In fact your 1s delay between each run prevents this from happening even if you haven't any hysteresis

OK, thanks.. I agree that Hysteresis is the right practical approach here, I thought there was some other problem with the basic code construct...

Thank you guyz for the links, its great to see your code and code comments. Thx for the offer to help with arduino once i start Terry, i will let you know when i get stuck, ty.

I see its quite important to write code efficiently. I've just finished Class and Variables with multiple parameters so i still got whole heap of stuff to learn, but now i will definitely give extra attention for writing code properly, and practice it from begining.