I have tried to use pha555 version and can not get anything out of it think it must be wiring. looking at the code and the diagram I am confused.
This is what I did I use two analog inputs and output to a lcd.
This is my code if you can help build onto it let me know.
Thanks all,
Hugh
/*
Analog input, analog output, serial output
Reads input pin A0 for temp from sensor and outputs degress f
Reads input pin A1 for humidity from sensor and outputs in %
Reads an analog input pin, maps the result to a range from 0 to 255
and uses the result to set the pulsewidth modulation (PWM) of an output pin.
Also prints the results to the serial monitor.
The circuit:
- Temp sensor output connected to analog pin 0.
Humidity sensor output connected to analog pin 1
- LED connected from digital pin 9 to ground
LCD connections reset connected to digital pin 12
enable = D11
DB4 = D5
DB5 = D4
DB6 = D3
DB7 = D2
created 7 Oct 2010
Modified 7 Oct 2010
by Hugh Coleman
This example code is in the public domain.
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input on pin A0 for temp reading
const int analogOutPin = 9; // Analog output pin that the LED is attached to
const int analogInPinOne = A1; // Analog input pin A1 for humidity reading
int tempValue = 0; // value read from sensor output
int outputValue = 0; // value output to the PWM (analog out)
int humidValue = 0;
int OutPutValueOne = 0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
tempValue = analogRead(analogInPin); //reads the value on analog pin a0:
humidValue = analogRead(analogInPinOne); //reads the value on analog pin a1
// map it to the range of the analog out:
outputValue = map(tempValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(tempValue);
// sets the cursor and prints Temp:
lcd.setCursor(2,0);
lcd.print("Temp"); //outputs Temp to lcd:
// sets the cursor and prints the current temp in F:
lcd.setCursor(11, 0);
lcd.print(tempValue*.155); //calls the tempValue multiplies it times .155:
// sets the cursor and prints Humidity:
lcd.setCursor(0, 1);
lcd.print("Humidity"); //outputs Humidity to lcd:
// sets the cursor and prints the current relative humidity:
lcd.setCursor(11, 1);
lcd.print(humidValue/10); //analog a1 input divided by 10:
// sets the cursor and prints the % sign
lcd.setCursor(14, 1);
lcd.print("%");
// delay 3 seconds:
delay(3000);
Serial.print("\t output = ");
lcd.clear();
Serial.println(outputValue);
}