LCD showing "1" or "0" after text.

Hi all. My display is showing “1” or “0” after the line of text. Idk where it is getting the 1 or 0. But it changes when the “Fan Disabled” goes to “Fan Enabled.” See photos. It shows it after the outside temp read out. Any ideas?? See photos.

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

LiquidCrystal_I2C lcd(0x27,20,4);

// 2 DS18B20 SENSORS, both datas connected to PIN 8.
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

//declare variables, constants

float outhouse_temp=0.0;
float inhouse_temp=0.0;
byte LED=9; //PWM pin

void setup()


Serial.begin(9600); //Start library
Serial.print(“Starting System”);
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
lcd.print(“System Booting…”);
lcd.print(“Collecting Data…”);

void loop()
inhouse_temp = sensors.getTempFByIndex(0);
outhouse_temp = sensors.getTempFByIndex(1);

delay(750); //12 Bit resolution = 750milliS conversion time.

Serial.print("Inside: "); Serial.println(inhouse_temp); //Serial Prints Inside temp
Serial.print("Outside: "); Serial.println(outhouse_temp); //Serial Prints Outside temp

lcd.print("INSIDE: ");

lcd.print("OUTSIDE: ");

if (outhouse_temp > inhouse_temp - 2 || inhouse_temp < 65.0) //2 degree hysteresis. Compares in/out temps & makes a decision.
lcd.print("FAN DISABLED ");

else {digitalWrite(LED,LOW);
lcd.print("FAN ENABLED ");




It comes from these lines:



digitalRead() returns either 0 (LOW) or 1 (HIGH).

OK, get with the project!

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can easily be quite garbled and is always more difficult to read.

It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only between complete functional blocks.



A common problem is that when printing a number you need to determine how many leading digits that number will have. If it will have only one digit (that is, less than 10) then you need to print a blank space first. If in fact you will be having numbers that may be 100 or greater, you need to print one space for a number between 10 and 100, and two for a number less than 10.

Your use of decimals complicates this - I am not sure how many decimal places are defined in your print statement.