I just amended the code and was able to see changes. Now the 7 segment can display 10 when the water level reaches 10cm, 20 when the water level reaches 20cm and 30 when the water level reaches 30 cm . Now the problem is that when the water level reaches 10cm it shows 10 , when the water level reach 20cm its show 10 than 20 continously in the 7 segment. When it reaches 30cm the 7 segment shows 10 then 20 then 30 continously. How to solve this pro?