Reading water level sensor data
As we plan to have a water tank later in the chapter, it will be beneficial to have a water level sensor, so we can tell when the tank is empty. We'll start off by adding the sensor to our existing circuit. Follow these steps to do so:
- Connect pin A4 from the Arduino with F22 on the breadboard using a jumper cable.
- Connect pin D3 from the Arduino with F21 on the breadboard using a jumper cable.
- Connect J22 on the breadboard with the S (Signal) port on the sensor using a jumper cable.
- Connect J21 on the breadboard with the + (VCC) port on the sensor using a jumper cable.
- Connect - GND from the sensor with GND on the power bus.
The result should now look like the following figure:
After assembling this, we can continue to also create a small library for this sensor.
Writing a water level sensor library
There are...