4-ds18b20 temp sensors / 20x4 LCD / Uno ???

I am trying to read the temps of 4 ds18b20 (one wire) sensors on a parallax 20x4 pn27979 lcd. I am using 2 sketches as reference. I am trying to get 4 lines total (one temp per line) to show on the lcd.
pinout(s)
sensors are 5v, gnd and pin 3
lcd is 5v, gnd and pin 6

I used a tutorial to accurately address my sensors.

ultimately I would like the sensor names to stay constant while the temps changed but I am not sure how to do that.

Any help would be truly appreciated.

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SoftwareSerial.h>

const int TxPin = 6;

SoftwareSerial mySerial = SoftwareSerial(255, TxPin);

#define ONE_WIRE_BUS 3

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

DeviceAddress Int = { 0x28, 0xF7, 0x66, 0x8F, 0x05, 0x00, 0x00, 0x12 };
DeviceAddress Ext = { 0x28, 0x63, 0x7B, 0x8F, 0x05, 0x00, 0x00, 0xEF };
DeviceAddress Intake = { 0x28, 0x61, 0x56, 0x8F, 0x05, 0x00, 0x00, 0x95 };
DeviceAddress Exhaust = { 0x28, 0x41, 0x63, 0x8E, 0x05, 0x00, 0x00, 0xFA };

void setup() 
{
  mySerial.begin(9600);

  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(Int, 10);
  sensors.setResolution(Ext, 10);
  sensors.setResolution(Intake, 10);
  sensors.setResolution(Exhaust, 10); 
}

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC == -127.00) {
  } 
  else {

    mySerial.print(" F: ");
    mySerial.print(DallasTemperature::toFahrenheit(tempC));
  }

  pinMode(TxPin, OUTPUT);
  digitalWrite(TxPin, HIGH);

  mySerial.begin(9600);
  delay(100);
  sensors.requestTemperatures();

  mySerial.write(12);                 // Clear             
  mySerial.write(17);                 // Turn backlight on
  delay(3000);                        // Required delay
  mySerial.print("Int");  
  printTemperature(Int);
  mySerial.write(13);                  //Next line               
  mySerial.print("EXT"); 
  printTemperature(Ext);  
  mySerial.write(13);                  //Next line               
  mySerial.print("Intake");  
  printTemperature(Intake);
  mySerial.write(13);                  //Next line               
  mySerial.print("Exhaust"); 
  printTemperature(Exhaust);
  delay(3000);                        // Wait 3 seconds
  mySerial.write(18);                 // Turn backlight off
}
void loop() {
}

Sorry, I forgot to mention what my problem is. I could read my sensors to the serial monitor but when I changed to the mySerial. write I am NOT getting anything to the lcd. the sketch compiles and uploads but I just can't see it on my lcd.

I need help getting this to show properly on the lcd. thanks again for any assistance.

try to print only the integer part

mySerial.print( (int) DallasTemperature::toFahrenheit(tempC) );

might be a problem of the SW serial used that it doesn't support printing of floats .

the sketch compiles and uploads but I just can't see it on my lcd.

Have you successfully made anything appear on the LCD?

no sir. I have a sketch for the 4 ds18b20 sensors and I can read them on the serial monitor great and I have a basic sketch for the 20x4 lcd that displays the parallax message just fine but what you see above is me trying to merge the two together. I have been working on this for a while (trial and error) and could sure use the help.

and I have a basic sketch for the 20x4 lcd that displays the parallax message just fine

Can you post that sketch?

Do you have the baud rate of the display set correctly ?

can you send the datasheet of the lcd?

one wire 20x4 lcd ???????????

PaulS:

and I have a basic sketch for the 20x4 lcd that displays the parallax message just fine

Can you post that sketch?

+1 - do you know for sure that your LCD code is written properly? Try writing a sketch that just writes to the LCD before combining the two.

Here is a link to the Parallax LCD (#27979) pic 1B, Rev E.

Here is my LCD sketch that works fine.

const int TxPin = 6;

#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(255, TxPin);

void setup() {
    
  pinMode(TxPin, OUTPUT);
  digitalWrite(TxPin, HIGH);
  
  mySerial.begin(9600);
  delay(100);
  mySerial.write(12);                 // Clear             
  mySerial.write(17);                 // Turn backlight on
  delay(3000);                        // Required delay
  mySerial.print("I");  // First line
  mySerial.write(13);
  mySerial.write("love");
  mySerial.write(13);
  mySerial.write("Rebecca!");
  mySerial.write(13);  // Form feed
  mySerial.print("-Shawn");   // Second line
  mySerial.write(212);                // Quarter note
  mySerial.write(220);                // A tone
  delay(3000);                        // Wait 3 seconds
  mySerial.write(18);                 // Turn backlight off

}

void loop() {
}

Here is my sketch for my 4 ds18b20 sensors that print to the serial monitor which works fine.

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 3

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

DeviceAddress Int = { 0x28, 0xF7, 0x66, 0x8F, 0x05, 0x00, 0x00, 0x12 };
DeviceAddress Ext = { 0x28, 0x63, 0x7B, 0x8F, 0x05, 0x00, 0x00, 0xEF };
DeviceAddress Intake = { 0x28, 0x61, 0x56, 0x8F, 0x05, 0x00, 0x00, 0x95 };
DeviceAddress Exhaust = { 0x28, 0x41, 0x63, 0x8E, 0x05, 0x00, 0x00, 0xFA };

void setup(void)
{
  Serial.begin(9600);

  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(Int, 10);
  sensors.setResolution(Ext, 10);
  sensors.setResolution(Intake, 10);
  sensors.setResolution(Exhaust, 10);
}

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC == -127.00) {
    Serial.print("Error getting temperature");
  } 
  else {

    Serial.print(" F: ");
    Serial.print(DallasTemperature::toFahrenheit(tempC));
  }
}

void loop(void)
{ 
  delay(5000);
  Serial.print("Getting temperatures...\n\r");
  sensors.requestTemperatures();

  Serial.print("Int: ");
  printTemperature(Int);
  Serial.print("\n\r");

  Serial.print("Ext: ");
  printTemperature(Ext);
  Serial.print("\n\r");

  Serial.print("Intake: ");
  printTemperature(Intake);
  Serial.print("\n\r");

  Serial.print("Exhaust: ");
  printTemperature(Exhaust);
  Serial.print("\n\r");

  Serial.print("\n\r\n\r");
}

Here is my LCD sketch that works fine.

Which sends more than just text to the LCD.

Your code to read from the sensors and write to the LCD sends JUST text to the LCD. I'm going to go out on a limb here and say that the commands are probably important.

the lcd sketch was just to test and confirm that I had it connected properly and that the lcd display worked. Now I am trying to get the sensor data to the lcd and that is where i need the help which is the first sketch I posted in this thread. Any help PaulS would be much appreciated.

You don't set the mode of your LCD output pin until after you call mySerial.begin.

SleepyDoc could you please explain?

With the caveat that I have never used these libraries, myserial.begin(9600) calls an initialization routine using the pin you specified earlier, but you never set the pinmode as output until after calling myserial.begin. Is the LCD display initializing properly?

Write your own sketch to display text on the LCD and make sure it works; go thorough and learn what each line in the example sketch does. It will make more sense to you and be easier to debug than if you just blindly copy bits of code.