Notice to YSPilots/YSFLIGHT

Notice to YSPilots/YSFLIGHT
Legacy Pack available under the YSFLIGHT category.
Any individual requests for a model must be made to my email address, see bottom of the page..
Enjoy!
Skippy

Thursday, 25 April 2013

Project Freya: Moisture Sensor to the LCD screen

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:

DSCF0462

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:

DSCF0459

And when my dry fingers are across the two wires:

DSCF0461

// The potentiometer to the left is for LCD brightness

No comments: