worked out the * display bit for when the heater is on ![]()
updated code bellow:
/*
Will start and stop a peltier device in a pad under a fish bowl
depending on what the value of the thermsistor returns from
the water temprature and then display a status message
onto the LCD (2x16)
The circuit:
* LCD 1 GND
* LCD 2 VCC
* LCD 4 RS pin to digital pin 12
* LCD 6 Enable pin to digital pin 11
* LCD 11 D4 pin to digital pin 5
* LCD 12 D5 pin to digital pin 4
* LCD 13 D6 pin to digital pin 3
* LCD 14 D7 pin to digital pin 2
* LCD 3 VO pin to GND
* LCD 15 + LED
* LCD 16 - LED
* Thermsistor to +5 and A0 and A0 resistor to gnd
* LED D13
* Heatpump D10
LCD Library and code borrowed from:
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include LCD library
#include <LiquidCrystal.h>
// initialize pins and initial value
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = 0;
int ledPin = 9;
int heatPin = 10;
int sensorValue = 0;
int state = 0;
void setup() {
// set up the LCD, and pins
lcd.begin(16, 2);
pinMode(ledPin,OUTPUT);
pinMode(heatPin,OUTPUT);
//Blink to show startup
digitalWrite(ledPin, HIGH);
digitalWrite(heatPin, LOW);
delay(35);
digitalWrite(ledPin, LOW);
}
void loop() {
lcd.setCursor(2, 0);
lcd.print("FishFishHeat");
lcd.setCursor(13, 1);
lcd.print(sensorValue);
sense(); // sensor input
if (sensorValue <= 85){
heatOn(); // start heatpump
}
else {
lcd.setCursor(5, 1);
lcd.print("is OK");
}
if (sensorValue >= 92) {
heatOff(); // stop heatpump
}
// Turn on the display:
lcd.display();
delay(125);
lcd.clear();
if (state == 1){
lcd.setCursor(0, 0);
lcd.print("*");
lcd.setCursor(15, 0);
lcd.print("*");
}
}
void sense() { // sensor input
sensorValue = analogRead(sensorPin);
state = digitalRead(ledPin);
}
void heatOn() { // start heatpump
digitalWrite(ledPin, HIGH);
digitalWrite(heatPin, HIGH);
lcd.setCursor(1, 1);
lcd.print("is Low Temp");
}
void heatOff() { // stop heatpump
digitalWrite(ledPin, LOW);
digitalWrite(heatPin, LOW);
lcd.setCursor(1, 1);
lcd.print("is Hi Temp");
}
am about to test with heatpad attached will grab pics of the setup ![]()