Hi, I am totally new here and am struggling a bit with some coding expansion. I am building a temperature gradient board using 10 ceramic tiles heated by peltiers with ds18b20 sensors using 5 dual gated H-gates so that i am able to cool as well as heat the tiles. All this is thru a Mega 2560
the sketch i am using is as below and i am not sure how the coding goes to expand it out to include the 10 sensors (one wire and i have the addresses) and the individual control of the outputs to the digital pins.
this sketch works fine for what i am doing but only works the one H-gate
if anyone can help, it would be appreciated
#include <Wire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_I2C.h>
#define RELAY1 50 // Relay heating
#define RELAY2 51 // Relay coolingv
int red = 53; // red LED heating
int blue = 52;
#define BACKLIGHT_PIN 13
#define ONE_WIRE_BUS 7
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(9600);
sensors.begin();
lcd.begin(20, 4);
lcd.backlight();
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(RELAY1, OUTPUT);
pinMode(RELAY2, OUTPUT);
}
void loop() {
lcd.setCursor(0, 0);
lcd.print(" TEMP today");
sensors.requestTemperatures();
float temperature = sensors.getTempCByIndex(0);
lcd.setCursor(3, 1);
lcd.print(" ");
lcd.print(sensors.getTempCByIndex(0));
lcd.print("\337C");
if (temperature < 24.00)
{
digitalWrite(red, HIGH);
digitalWrite(blue, LOW);
lcd.setCursor(0, 1);
lcd.print("Heating");
digitalWrite(RELAY1, 0);
digitalWrite(RELAY2, 1);
}
else if (temperature > 24.00)
{
digitalWrite(RELAY1, 1);
digitalWrite(RELAY2, 0);
digitalWrite(red, LOW);
digitalWrite(blue, HIGH);
lcd.setCursor(0, 1);
lcd.print("Cooling ");
lcd.setCursor(0, 3);
}
}
i would also like the individual tile temps displayed on the lcd.
thanks for your time