Sensors not displaying

im trying to post what my temp sensor is reading(sensors.getTempFByIndex(0)) and what my controller is set to(Temp01SetPoint) on an esp8266 arduino web server but it isnt showing anything
any suggestions?

<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";

<center><strong>SET TEMP<form><input type=number value=Temp01SetPoint readonly>" ;

(deleted)

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27(Cooperate with 3 short circuit caps) for a 16 chars and 2 line display
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS_PIN 4
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);

//

//

int backlightState = LOW;
long previousMillis = 0;
long interval = 1000;
int Relay1 = 5;
int Relay2 = 6;
int Temp01SetPoint = 68;
int Temp01SetDiff = .5;
const int buttonPin = 7;    
int buttonState = 0;
const int button1Pin = 8;    
int button1State = 0;

void setup() {
 //
connect();
//
lcd.init();                      // initialize the lcd 
lcd.backlight();
lcd.home();
lcd.begin(16, 2);
fill();
delay(5000);
lcd.clear();
sensors.begin();
pinMode(Relay1, OUTPUT);
pinMode(Relay2, OUTPUT);
  //turn off the relays to start
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
 pinMode(buttonPin, INPUT);  
 pinMode(button1Pin, INPUT);
 }
void fill()
{lcd.setCursor(3,0);
lcd.print("Irons Gate");
lcd.setCursor(4,1);
lcd.print("Brewery");}

void loop()
{
control();  
sensors.requestTemperatures();
lcd.setCursor(0,0);
lcd.print("FV1 SET=      F");
lcd.setCursor(10,0);
lcd.print(Temp01SetPoint);
lcd.setCursor(0,1);
lcd.print("FV1=        F");
lcd.setCursor(5,1);
lcd.print(sensors.getTempFByIndex(0));
Serial.println(sensors.getTempFByIndex(0));
buttonState = digitalRead(buttonPin);
Serial.println(buttonState);
button1State = digitalRead(button1Pin);
Serial.println(button1State);
//COOLING
if  (sensors.getTempFByIndex(0)>(Temp01SetPoint+Temp01SetDiff))
    digitalWrite(Relay1,LOW);
    else if (sensors.getTempFByIndex(0)== Temp01SetPoint)
    digitalWrite(Relay1,HIGH);
//HEATING
if (sensors.getTempFByIndex(0)<(Temp01SetPoint-Temp01SetDiff))
   digitalWrite(Relay2,LOW);
   else if (sensors.getTempFByIndex(0)== Temp01SetPoint)
   digitalWrite(Relay2,HIGH);
if (sensors.getTempFByIndex(0)<(Temp01SetPoint-Temp01SetDiff))
   digitalWrite(Relay1,LOW);
   else if (sensors.getTempFByIndex(0)== Temp01SetPoint)
   digitalWrite(Relay1,HIGH);
//PUSH BUTTONS
if (buttonState == HIGH)       
  {Serial.println("Button is       ON ");   
  ++Temp01SetPoint;
  Serial.println(Temp01SetPoint);} 
  else 
  { Serial.println("Button is OFF"); };
if (button1State == HIGH)       
  {Serial.println("Button is       ON ");    
  --Temp01SetPoint;
  Serial.println(Temp01SetPoint);} 
  else 
  { Serial.println("Button is OFF"); };
  delay(100);  
// 
    //
}
#include <SoftwareSerial.h> 
#define DEBUG true 
SoftwareSerial esp8266(2,3);

void connect(){
 Serial.begin(9600);
  esp8266.begin(9600); // your esp's baud rate might be different
  sendData("AT+RST\r\n",2000,DEBUG); // reset module
  sendData("AT+CWMODE=1\r\n",1000,DEBUG); // configure as access point
  sendData("AT+CWJAP=\"SSID\",\"PASSWORD\"\r\n",3000,DEBUG);
  delay(3000);
  sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address
  sendData("AT+CIPMUX=1\r\n",1000,DEBUG); // configure for multiple connections
  sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80
}
void control()
{if(esp8266.available()) // check if the esp is sending a message 
  {
 if(esp8266.find("+IPD,"))
    {
     delay(1000);
 
     int connectionId = esp8266.read()-48; // subtract 48 because the read() function returns 
                                           // the ASCII decimal value and 0 (the first decimal number) starts at 48
     float tempf= sensors.getTempFByIndex(0);
String webpage = "<body background=https://scontent-iad3-1.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/1462848_572151666199012_864666124_n.jpg?oh=52378bc2ac8912fab163de0d70fef52b&oe=57B46108>" ;
     String cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend += webpage.length();
     cipSend +="\r\n";
     sendData(cipSend,100,DEBUG);
     sendData(webpage,1000,DEBUG);
     
     webpage = "<font color=#66ff00><h1><center>IRONS GATE BREWERY</h1>";    
     cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend += webpage.length();
     cipSend +="\r\n";     
     sendData(cipSend,100,DEBUG);
     sendData(webpage,1000,DEBUG);
     
     webpage="<center><strong>SET TEMP<form><input type=number step=1 value=Temp01SetPoint readonly>" ;     
     cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend +=webpage.length();
     cipSend +="\r\n";     
     sendData(cipSend,1000,DEBUG);
     sendData(webpage,1000,DEBUG);

     webpage= "<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";
     cipSend = "AT+CIPSEND=";
     cipSend += connectionId;
     cipSend += ",";
     cipSend += webpage.length();
     cipSend +="\r\n";
     sendData(cipSend,1000,DEBUG);
     sendData(webpage,1000,DEBUG);
    
     String closeCommand = "AT+CIPCLOSE="; 
     closeCommand+=connectionId; // append connection id
     closeCommand+="\r\n";
     
     sendData(closeCommand,3000,DEBUG);
    }
  }
}
String sendData(String command, const int timeout, boolean debug)
{
    String response = "";
    esp8266.print(command); // send the read character to the esp8266
    long int time = millis();
    while( (time+timeout) > millis())
    {
      while(esp8266.available())
      {
       // The esp has data so display its output to the serial window 
        char c = esp8266.read(); // read the next character.
        response+=c;}     }
    if(debug)
    {Serial.print(response);}
    
    return response;
}

Your formatting is atrocious. Put EVERY { on a line by itself. Put EVERY } on a line by itself. Use Tools + Auto Format, and then post your code again.

What do your Serial.print()s tell you is happening? Why don’t you have any, where it matters?

PaulS: Your formatting is atrocious. Put EVERY { on a line by itself. Put EVERY } on a line by itself. Use Tools + Auto Format, and then post your code again.

What do your Serial.print()s tell you is happening? Why don't you have any, where it matters?

Sorry for the formating first time attempting any of this and trying to remember any html from high school is hard

trying to remember any html from high school is hard

No need to, is there? http://w3schools.com/

PaulS: No need to, is there? http://w3schools.com/

I have been looking at that I would say 90% of what I posted is just copied and pasted from other projects that look like what I am trying to do. The first code is for my fermentation control the second is trying to put it online

This is the first and last project I'm just asking for help as a means to an end haha

Hi,

What is your electronics, programming, arduino, hardware experience?

You need to start projects like this in stages.

Work out what separate actions you are trying to accomplish, and program them and get them working on their own.

Then begin integrating them one at a time, getting each integration working before going to the next.

Pasting extraneous does no one any help, as each piece will not have documentation on how it works.

Tom.... :)

TomGeorge: Hi,

What is your electronics, programming, arduino, hardware experience?

You need to start projects like this in stages.

Work out what separate actions you are trying to accomplish, and program them and get them working on their own.

Then begin integrating them one at a time, getting each integration working before going to the next.

Pasting extraneous does no one any help, as each piece will not have documentation on how it works.

Tom.... :)

Hey tom Like I said no experience with this a little html in high school

I have been building in stages the first section of code is a temperature controller that operates two relays the second is a Web server. Both are working great by themselves

My issue is when integrating the two I cannot get the Web server to show the sensor temp or the set point

My issue is when integrating the two I cannot get the Web server to show the sensor temp or the set point

Using what code?

     webpage= "<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";

You don’t really expect that assignment statement to call the getTempFByIndex() function, do you?

PaulS:
Using what code?

     webpage= "<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";

You don’t really expect that assignment statement to call the getTempFByIndex() function, do you?

Paul
that is where i am getting stuck not sure how to figure it out hence my posting a question to you guys
here is the code auto formatted the first one is the temperature controller the second the webserver

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27(Cooperate with 3 short circuit caps) for a 16 chars and 2 line display
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS_PIN 4
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);

int backlightState = LOW;
long previousMillis = 0;
long interval = 1000;
int Relay1 = 5;
int Relay2 = 6;
int Temp01SetPoint = 68;
int Temp01SetDiff = .5;
const int buttonPin = 7;
int buttonState = 0;
const int button1Pin = 8;
int button1State = 0;

void setup() {
  //
  connect();
  //
  lcd.init();                      // initialize the lcd
  lcd.backlight();
  lcd.home();
  lcd.begin(16, 2);
  fill();
  delay(5000);
  lcd.clear();
  sensors.begin();
  pinMode(Relay1, OUTPUT);
  pinMode(Relay2, OUTPUT);
  //turn off the relays to start
  digitalWrite(Relay1, HIGH);
  digitalWrite(Relay2, HIGH);
  pinMode(buttonPin, INPUT);
  pinMode(button1Pin, INPUT);
}
void fill()
{ lcd.setCursor(3, 0);
  lcd.print("Irons Gate");
  lcd.setCursor(4, 1);
  lcd.print("Brewery");
}

void loop()
{
  control();
  sensors.requestTemperatures();
  lcd.setCursor(0, 0);
  lcd.print("FV1 SET=      F");
  lcd.setCursor(10, 0);
  lcd.print(Temp01SetPoint);
  lcd.setCursor(0, 1);
  lcd.print("FV1=        F");
  lcd.setCursor(5, 1);
  lcd.print(sensors.getTempFByIndex(0));
  Serial.println(sensors.getTempFByIndex(0));
  buttonState = digitalRead(buttonPin);
  Serial.println(buttonState);
  button1State = digitalRead(button1Pin);
  Serial.println(button1State);
  //COOLING
  if  (sensors.getTempFByIndex(0) > (Temp01SetPoint + Temp01SetDiff))
    digitalWrite(Relay1, LOW);
  else if (sensors.getTempFByIndex(0) == Temp01SetPoint)
    digitalWrite(Relay1, HIGH);
  //HEATING
  if (sensors.getTempFByIndex(0) < (Temp01SetPoint - Temp01SetDiff))
    digitalWrite(Relay2, LOW);
  else if (sensors.getTempFByIndex(0) == Temp01SetPoint)
    digitalWrite(Relay2, HIGH);
  if (sensors.getTempFByIndex(0) < (Temp01SetPoint - Temp01SetDiff))
    digitalWrite(Relay1, LOW);
  else if (sensors.getTempFByIndex(0) == Temp01SetPoint)
    digitalWrite(Relay1, HIGH);
  //PUSH BUTTONS
  if (buttonState == HIGH)
  { Serial.println("Button is       ON ");
    ++Temp01SetPoint;
    Serial.println(Temp01SetPoint);
  }
  else
  {
    Serial.println("Button is OFF");
  };
  if (button1State == HIGH)
  { Serial.println("Button is       ON ");
    --Temp01SetPoint;
    Serial.println(Temp01SetPoint);
  }
  else
  {
    Serial.println("Button is OFF");
  };
  delay(100);
  //
  //
}
#include <SoftwareSerial.h>
#define DEBUG true
SoftwareSerial esp8266(2, 3);

void connect() {
  Serial.begin(9600);
  esp8266.begin(9600); // your esp's baud rate might be different
  sendData("AT+RST\r\n", 2000, DEBUG); // reset module
  sendData("AT+CWMODE=1\r\n", 1000, DEBUG); // configure as access point
  sendData("AT+CWJAP=\"Johnston\",\"4017380838\"\r\n", 3000, DEBUG);
  delay(3000);
  sendData("AT+CIFSR\r\n", 1000, DEBUG); // get ip address
  sendData("AT+CIPMUX=1\r\n", 1000, DEBUG); // configure for multiple connections
  sendData("AT+CIPSERVER=1,80\r\n", 1000, DEBUG); // turn on server on port 80
}
void control()
{ if (esp8266.available()) // check if the esp is sending a message
  {
    if (esp8266.find("+IPD,"))
    {
      delay(1000);

      int connectionId = esp8266.read() - 48; // subtract 48 because the read() function returns
      // the ASCII decimal value and 0 (the first decimal number) starts at 48
      float tempf = sensors.getTempFByIndex(0);
      String webpage = "<body background=https://scontent-iad3-1.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/1462848_572151666199012_864666124_n.jpg?oh=52378bc2ac8912fab163de0d70fef52b&oe=57B46108>" ;
      String cipSend = "AT+CIPSEND=";
      cipSend += connectionId;
      cipSend += ",";
      cipSend += webpage.length();
      cipSend += "\r\n";
      sendData(cipSend, 100, DEBUG);
      sendData(webpage, 1000, DEBUG);

      webpage = "<font color=#66ff00><h1><center>IRONS GATE BREWERY</h1>";
      cipSend = "AT+CIPSEND=";
      cipSend += connectionId;
      cipSend += ",";
      cipSend += webpage.length();
      cipSend += "\r\n";
      sendData(cipSend, 100, DEBUG);
      sendData(webpage, 1000, DEBUG);

      webpage = "<center><strong>SET TEMP<form><input type=number value=Temp01SetPoint readonly>" ;
      cipSend = "AT+CIPSEND=";
      cipSend += connectionId;
      cipSend += ",";
      cipSend += webpage.length();
      cipSend += "\r\n";
      sendData(cipSend, 1000, DEBUG);
      sendData(webpage, 1000, DEBUG);

      webpage = "<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";
      cipSend = "AT+CIPSEND=";
      cipSend += connectionId;
      cipSend += ",";
      cipSend += webpage.length();
      cipSend += "\r\n";
      sendData(cipSend, 1000, DEBUG);
      sendData(webpage, 1000, DEBUG);

      String closeCommand = "AT+CIPCLOSE=";
      closeCommand += connectionId; // append connection id
      closeCommand += "\r\n";

      sendData(closeCommand, 3000, DEBUG);
    }
  }
}
String sendData(String command, const int timeout, boolean debug)
{
  String response = "";
  esp8266.print(command); // send the read character to the esp8266
  long int time = millis();
  while ( (time + timeout) > millis())
  {
    while (esp8266.available())
    {
      // The esp has data so display its output to the serial window
      char c = esp8266.read(); // read the next character.
      response += c;
    }
  }
  if (debug)
  {
    Serial.print(response);
  }

  return response;
}

the first one is the temperature controller the second the webserver

How do those two codes communicate?

      webpage = "<center><strong>SET TEMP<form><input type=number value=Temp01SetPoint readonly>" ;

If this is supposed to display the set point, I’m sure that you are disappointed that nothing but text appears.

     webpage= "<p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>";

If this is supposed to display the actual temperature, I’m sure that you are disappointed that nothing but text appears.

It should be fairly obvious that you need to use some mechanism to convert variable contents/function return values to strings. sprintf() is one such mechanism. itoa() is another. ftoa() is another.

actually im not even getting text in the box

actually im not even getting text in the box

So, now we know what you aren't getting.

Right click in the browser window. Select View source (or whatever the equivalent is on your browser). Show us what you ARE getting.

PaulS:
So, now we know what you aren’t getting.

Right click in the browser window. Select View source (or whatever the equivalent is on your browser). Show us what you ARE getting.

this is what i am getting when running

<body background=https://scontent-iad3-1.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/1462848_572151666199012_864666124_n.jpg?oh=52378bc2ac8912fab163de0d70fef52b&oe=57B46108><font color=#66ff00><h1><center>IRONS GATE BREWERY</h1><center><strong>SET TEMP<form><input type=number value=Temp01SetPoint readonly><p><center><strong>CURRENT TEMP</p><p><form><input type=number value=sensors.getTempFByIndex(0) readonly>

With a few carriage returns added:

IRONS GATE BREWERY

SET TEMP

CURRENT TEMP

I see a few problems.

First, there is no html tag, and no closing html tag.
There is no closing body tag.
There are two forms, with closing form tags.
There are two text boxes that are defined to show numbers (numeric values). The values for those text boxes are strings.

You need to correct all of these issues.

Here’s a hint:

      char webstuff[100];
      sprintf(webstuff,
                "<center><strong>SET TEMP<form><input type=number value=%d readonly>",
                Temp01SetPoint );

      cipSend = "AT+CIPSEND=";
      cipSend += connectionId;
      cipSend += ",";
      cipSend += strlen(webstuff);
      cipSend += "\r\n";
      sendData(cipSend, 1000, DEBUG);
      sendData(webstuff, 1000, DEBUG);