Soil Moisture & Rain Sensors
Next on the new sensors to play with list is a soil moisture sensor and the similar rain sensor, both use the same LM393 opamp comparator board.
The pinout is:
AO - A7
DO - D2
VCC - 3.3v
GND - GND
The digital output basically gives a 0/1 based on if the moisture/rainfall has reached a certain level (adjusted with the trimpot).
My code is:
const int aPin = A7;
const int dPin = 2;
int moisture = 0;
bool isRaining = false;
void setup()
{
Serial.