Go Down

Topic: Temeratures control with outputs (Read 2 times) previous topic - next topic

PaulS

Quote
This is working OK:

So, the temperature in tank 1 will never be between 25 and 26.5?

In tank 2, the ranges overlap. Stuff happens in the first block if the temperature is between 24 and 25. Stuff happens in the second block for temperatures in that same range. Is that OK? Stuff happens in the 2nd and 3rd block for temperatures in the range 25 to 26. Is that OK?

Adding a Serial.print() statement just before the tank3temp stuff would confirm the temperature in tank 3. A Serial.print() would confirm whether or not the statement evaluated to true.

kikitron

Than I have to write a new code?
I dont know how can I read tank1temp, tank2temp and tank3temp differently like i wrote.

I need to write : if (tank1temp >= 25) than power on pump1 and grean led....

PaulS

Quote
Than I have to write a new code?

To some extent, yes. That's not the end of the world.
void float pringetTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  float t1tempC = sensors.getTempC(tank1Thermometer);
  float t2tempC = sensors.getTempC(tank2Thermometer);
  float t3tempC = sensors.getTempC(tank2Thermometer);
  if (tempC == -127.00) {
lcd.print("Err");
} else {
// lcd.print(tempC);
// lcd.print("/");
tank1temp = t1tempC;
tank2temp = t2tempC;
tank3temp = t3tempC;

lcd.print(tempC);
  }
  return tempC;
}

Then, change printTemperature to getTemperature() in loop, and store the returned value in the appropriate variable.

tank1temp = getTemperature(tank1Thermometer);

kikitron

I will have different temperatures at the end. Now I have lower temerature so I can test it in the room.

At the and should be like that:
Code: [Select]
if (tank1temp <= 59)
{
 digitalWrite(tank1, LOW); // pump1 ON
 digitalWrite(tank1RLED, HIGH); // read led OFF
 digitalWrite(tank1GLED, HIGH); // green led OFF
 digitalWrite(tank1BLED, HIGH); // blue led ON
}

if (tank1temp >= 60 && tank1temp <= 62)

{
 digitalWrite(tank1, HIGH);
 digitalWrite(tank1RLED, HIGH);
 digitalWrite(tank1GLED, HIGH);
 digitalWrite(tank1BLED, HIGH);
}

if (tank1temp >= 65)
{
 digitalWrite(tank1, LOW);
 digitalWrite(tank1RLED, HIGH);
 digitalWrite(tank1GLED, HIGH);
 digitalWrite(tank1BLED, HIGH);
}


if (tank2temp <= 35)
{
 digitalWrite(tank1, HIGH);
 digitalWrite(tank2BLED, HIGH);
 digitalWrite(tank2GLED, HIGH);
 digitalWrite(tank2RLED, HIGH);
}

if (tank2temp >= 36 && tank2temp <= 38)

{
 digitalWrite(tank2GLED, HIGH);
 digitalWrite(tank2RLED, HIGH);
 digitalWrite(tank2BLED, HIGH);
}

if (tank2temp >= 40)
{
 digitalWrite(tank1, LOW);
 digitalWrite(tank2, LOW);
 digitalWrite(tank1RLED, HIGH);
 digitalWrite(tank1GLED, HIGH);
 digitalWrite(tank1BLED, HIGH);
 digitalWrite(tank2RLED, HIGH);
 digitalWrite(tank2GLED, HIGH);
 digitalWrite(tank2BLED, HIGH);
}


if (tank3temp >= 70)
{
 digitalWrite(tank3, HIGH);
}

Quick5pnt0

#24
Jan 27, 2013, 10:36 pm Last Edit: Jan 27, 2013, 10:40 pm by Quick5pnt0 Reason: 1

I have another question about LCD that I have it 1602.
The text on it is realy hard to see (very dark), I can see it only from upper angle and on the front you cant see it. Backlight is working ok but text is realy bad.
Do I have to change something in the program that the text will be lighter?

I have QUAPASS 1602A bluescreen and I think that text should be white.


How do you have it wired? Are you using a potentiometer for the contrast like this:
http://arduino.cc/en/Tutorial/LiquidCrystal

Go Up