Somtimes, we need to measure the level of water in a recipient, or if you want to see the level of water in a tank, it is a requirement to measure the levels of water that it has; so in this section, we will explain how to do this.
The sensor is Normally Open. When the water is over the limit, the contact opens, and it sends a signal to the Arduino board. We use pin number
2, which is a digital input:
We declare the variables and
const in the program:
const int buttonPin = 2; // the number of the input sensor pin const int ledPin = 13; // the number of the LED pin
We also define the states of the digital ...