Okay, the first thing I thought would be useful would be to write data to an LCD screen, and my arduino starter kit came with an LCD screen.
So, my set up looks like this:
The sensor leads are going off in the middle on the left hand side of the image.
Tada! Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(0, 1, 5, 4, 3, 2);
const int sensorPin = A0;
const float baselineMoisture = 0.0;
void setup(){
lcd.begin(16,2);
// Serial.begin(9600);
lcd.print("loading");
}
void loop(){
int sensorVal = analogRead(sensorPin);
// Serial.println(sensorVal);
lcd.print(sensorVal);
delay(500);
lcd.clear();
}
The result is this:
When the sensor (Two wires… 2 posts ago…) is not touching anything moist it reads 0:
And when my dry fingers are across the two wires:
// The potentiometer to the left is for LCD brightness
No comments:
Post a Comment