ESP 8266 HELP

im Trying to make a temperature sensor send data to my webpage, however I keep getting errors and expected ; before my sensor definition. Any help? here is my arduino uno code and my webpage code

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

#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
String ssid ="....";

String password="....";

SoftwareSerial esp(6, 7);// RX, TX

String data;

String server = "...."; // www.example.com

String uri = "/esp8266.php";// our example is /esppost.php



byte dat [5];


void setup() {



esp.begin(9600);

Serial.begin(9600);

reset();

connectWifi();

}

//reset the esp8266 module

void reset() {

esp.println("AT+RST");

delay(1000);

if(esp.find("OK") ) Serial.println("Module Reset");

}

//connect to your wifi network

void connectWifi() {

String cmd = "AT+CWJAP=\"" +ssid+"\",\"" + password + "\"";

esp.println(cmd);

delay(4000);

if(esp.find("OK")) {

Serial.println("Connected!");

}

else {

connectWifi();

Serial.println("Cannot connect to wifi"); }

}

byte read_data () {

byte data;

for (int i = 0; i < 8; i ++) {

if (digitalRead (ONE_WIRE_BUS) == LOW) {

while (digitalRead (ONE_WIRE_BUS) == LOW); // wait for 50us

delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'

if (digitalRead (ONE_WIRE_BUS) == HIGH)

data |= (1 << (7-i)); // high front and low in the post

while (digitalRead (ONE_WIRE_BUS) == HIGH);

// data '1 ', wait for the next one receiver

}

} return data; }

void start_test () {

digitalWrite ONE_WIRE_BUS, LOW); // bus down, send start signal

delay (30); // delay greater than 18ms, so DHT11 start signal can be detected

digitalWrite (ONE_WIRE_BUS, HIGH);

delayMicroseconds (40); // Wait for DHT11 response

pinMode (ONE_WIRE_BUS, INPUT);

while (digitalRead (DHpin) == HIGH);

delayMicroseconds (80);

// DHT11 response, pulled the bus 80us

if (digitalRead (ONE_WIRE_BUS) == LOW);

delayMicroseconds (80);

// DHT11 80us after the bus pulled to start sending data

for (int i = 0; i < 4; i ++)

// receive temperature and humidity data, the parity bit is not considered

dat[i] = read_data ();

pinMode (ONE_WIRE_BUS, OUTPUT);

digitalWrite (ONE_WIRE_BUS, HIGH);

// send data once after releasing the bus, wait for the host to open the next Start signal



void loop () {

start_test ();

// convert the bit data to string form

hum = String(dat[0]);

temp= String(dat[2]);

data = "temperature=" + temp + "&humidity=" + hum;// data sent must be under this form //name1=value1&name2=value2.

httppost();

delay(1000);

}

void httppost () {

esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection.

if( esp.find("OK")) {

Serial.println("TCP connection ready");

} delay(1000);

String postRequest =

"POST " + uri + " HTTP/1.0\r\n" +

"Host: " + server + "\r\n" +

"Accept: *" + "/" + "*\r\n" +

"Content-Length: " + data.length() + "\r\n" +

"Content-Type: application/x-www-form-urlencoded\r\n" +

"\r\n" + data;

String sendCmd = "AT+CIPSEND=";//determine the number of caracters to be sent.

esp.print(sendCmd);

esp.println(postRequest.length() );

delay(500);

if(esp.find(">")) { Serial.println("Sending.."); esp.print(postRequest);

if( esp.find("SEND OK")) { Serial.println("Packet sent");

while (esp.available()) {

String tmpResp = esp.readString();

Serial.println(tmpResp);

}

// close the connection

esp.println("AT+CIPCLOSE");

}

}}
<?php
$Temp=$_POST["temperature"];

$Write-"<p>Temperature : "  .  $Temp . " Celsius </p>";

file_put_contents('sensor.html',$Write);

?>

it is really
hard
to

read
your

code with

such
poor

formatting.bad
indenting, too many
empty

lines and curly
braces
belong on a line
of their own:

example:

void setup() 
{
  Serial.begin(9600);
  for(auto i : tempSensors)
  {
    sensors.setResolution(i, TEMPERATURE_PRECISION);
  }
  updateTemperatures(0);
}

you can try to use auto format in the IDE to get the indentation correct (you will have to do the white space and braces on your own) and update your posted code..

this is my error Arduino:1.8.1 (Windows 7), Tarjeta:"Arduino/Genuino Uno"

C:\Users\Julian\Documents\Arduino\esp\esp.ino: In function 'void reset()':

C:\Users\Julian\Documents\Arduino\esp\esp.ino:47:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if(esp.find("OK") ) Serial.println("Module Reset");

^

C:\Users\Julian\Documents\Arduino\esp\esp.ino: In function 'void connectWifi()':

C:\Users\Julian\Documents\Arduino\esp\esp.ino:61:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if(esp.find("OK")) {

^

C:\Users\Julian\Documents\Arduino\esp\esp.ino: In function 'void start_test()':

esp:4: error: expected ';' before numeric constant

#define ONE_WIRE_BUS 2

^

C:\Users\Julian\Documents\Arduino\esp\esp.ino:101:14: note: in expansion of macro 'ONE_WIRE_BUS'

digitalWrite ONE_WIRE_BUS, LOW); // bus down, send start signal

^

esp:111: error: 'DHpin' was not declared in this scope

while (digitalRead (DHpin) == HIGH);

^

esp:137: error: a function-definition is not allowed here before '{' token

void loop () {

^

esp:155: error: a function-definition is not allowed here before '{' token

void httppost () {

^

esp:205: error: expected '}' at end of input

}}

^

exit status 1
expected ';' before numeric constant

Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.

You are missing an opening parenthesis in function start_test():

digitalWrite ONE_WIRE_BUS, LOW); // bus down, send start signal

Fix that, auto format your code and retry. Many of the errors are derived from that. The warnings you have got are not causing the compilation to fail.