Hi
I am trying to make temperature sensors with Max and Min as well at Current in Celcius to display on LCD's using one arduino.
I can get it so that I can have 2 LCD's display with one probe hooked up, the 1st LCD displays all the data from the probe, I modified the code to suite more than one probe and display the infor or each on its own LCD.
I am using 2 x I2C LCD and 2 DS18B20 probes.
I am getting this message: 'LCDshowNum' was not declared in this scope
Any help is much appreciated I have tried everything I can think of.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <OneWire.h>
#include <DallasTemperature.h>
/*Define for DS18S20 data pins
* This data pins is to connect 4.7K Om resister and to 5V
*/
#define ONE_WIRE_BUS D4
//Define for LCD display pins
#define SCL_CLOCK_PIN D1
#define SDA_DATA_PIN D2
//Initialize OneWire library for temperature sensor
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
// set the LCD address
LiquidCrystal_I2C lcd1(0x27,16,2);
LiquidCrystal_I2C lcd2(0x3F,16,2);
float HighestTemp1 = 0.0;
float CurrentTemp1 = 0.0;
float LowestTemp1 = 0.0;
float HighestTemp2 = 0.0;
float CurrentTemp2 = 0.0;
float LowestTemp2 = 0.0;
// Set probe address
DeviceAddress Probe01 = { 0x28, 0xFF, 0x27, 0xC9, 0xC1, 0x17, 0x04, 0x50 };
DeviceAddress Probe02 = { 0x28, 0xFF, 0x41, 0x00, 0xC2, 0x17, 0x04, 0x93 };
void setup()
{
// start temperature sensor
sensors.begin();
sensors.requestTemperatures(); //get temperature
// Start the LCD
lcd1.init();
lcd2.init();
//lcd display screen backlight
lcd1.backlight();
lcd2.backlight();
//clear lcd display
lcd1.clear();
lcd1.home();
lcd2.clear();
lcd2.home();
//Set lowest, highest temperatues
CurrentTemp1 = sensors.getTempCByIndex(0);
HighestTemp1 = CurrentTemp1;
LowestTemp1 = CurrentTemp1;
CurrentTemp2 = sensors.getTempCByIndex(0);
HighestTemp2 = CurrentTemp2;
LowestTemp2 = CurrentTemp2;
// LCD display information
lcd1.setCursor(0,0);
lcd1.print(F("Current: "));
LCDshowNum(9,0,CurrentTemp1);
lcd1.setCursor(0,1);
lcd1.print(F("Ma: "));
LCDshowNum(3,1,HighestTemp1);
lcd1.setCursor(9,1);
lcd1.print(F("Mi: "));
LCDshowNum(12,1,LowestTemp1);
lcd2.setCursor(0,0);
lcd2.print(F("Current: "));
LCDshowNum(9,0,CurrentTemp2);
lcd2.setCursor(0,1);
lcd2.print(F("Ma: "));
LCDshowNum(3,1,HighestTemp2);
lcd2.setCursor(9,1);
lcd2.print(F("Mi: "));
LCDshowNum(12,1,LowestTemp2);
}
void loop()
{
sensors.requestTemperatures(); //get temperature
//Get Current
CurrentTemp1 = sensors.getTempCByIndex(0);
LCDshowNum(9,0,CurrentTemp1);
CurrentTemp2 = sensors.getTempCByIndex(0);
LCD2showNum(9,0,CurrentTemp1);
//Check if Hightest
if(CurrentTemp1 > HighestTemp1){
HighestTemp1 = CurrentTemp1;
LCDshowNum(3,1,HighestTemp1);
if(CurrentTemp2 > HighestTemp2){
HighestTemp2 = CurrentTemp2;
LCDshowNum(3,1,HighestTemp2);
//Chekc if Lowest
if(CurrentTemp1 < LowestTemp1){
LowestTemp1 = CurrentTemp1;
LCDshowNum(12,1,LowestTemp1);
if(CurrentTemp2 < LowestTemp2){
LowestTemp2 = CurrentTemp2;
LCDshowNum(12,1,LowestTemp2);
}
delay(1);
}
/*
* LCDshowNum
* LCD display location: x, y
* Float n: temperature to display
*/
void LCDshowNum(int x, int y, float n){
lcd1.setCursor(x,y);
lcd1.print(n);
lcd2.setCursor(x,y);
lcd2.print(n);
}