How to collect data using esp8266 with arduino board??

Hi. I do not know how to connect my wifi module (esp8266) with my water monitoring system. mostly what i found on the internet is not related to water sensing system. Also, i do not know how to display the data obtain from the sensor to the server(thingspeak.com). I have provided my coding below. can anyone help me out? Thanks!

/* Water Monitoring System Embedded System Development SSK4102 ------------------------------------------------------------- */

define WaterSensor_1 34

define WaterSensor_2 30

define Grove_Piezo_Buzzer 40

define LED1 44

define LED2 52

void setup(){ pinMode(WaterSensor_1, INPUT); pinMode(WaterSensor_2, INPUT);

pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT);

pinMode(Grove_Piezo_Buzzer, OUTPUT); }

void loop(){ /* The water sensor will switch LOW when water is detected. Get the Arduino to illuminate the LED and activate the buzzer when water is detected, and switch both off when no water is present */ if(digitalRead(WaterSensor_1) == LOW && digitalRead(WaterSensor_2) == LOW){ digitalWrite(LED1,HIGH); digitalWrite(LED2,HIGH); digitalWrite(Grove_Piezo_Buzzer, HIGH); delay(2); digitalWrite(Grove_Piezo_Buzzer, LOW); delay(40); }

if(digitalRead(WaterSensor_1) == LOW && digitalRead(WaterSensor_2) == HIGH){ digitalWrite(LED1,HIGH); digitalWrite(Grove_Piezo_Buzzer, HIGH); delay(2); digitalWrite(Grove_Piezo_Buzzer, LOW); delay(40); }

if(digitalRead(WaterSensor_1) == HIGH && digitalRead(WaterSensor_2) == LOW){ digitalWrite(LED2,HIGH); digitalWrite(Grove_Piezo_Buzzer, HIGH); delay(2); digitalWrite(Grove_Piezo_Buzzer, LOW); delay(40); } else{ digitalWrite(Grove_Piezo_Buzzer, LOW); digitalWrite(LED1,LOW); digitalWrite(LED2,LOW); } }

I think we need a bit more info. First are wanting the ESP to broadcast the information or do you want a server to go get the information from the ESP? I assume that this code is not for the ESP and you want to port it. The ESP have much fewer GPIOs and only one ADC to work with. So those LED pins will be in the sub 16 range. Keep in mind that some pins are dedicated to other functions on the ESP. Glossing over the code it looks fine except for the pin numbers. There is no difference in a water sensor or a light sensor or a humidity sensor as long as they are digital. Some will output a high or low and some will output I2C protocols which can send in actual values. if we can know which sensors you have we can recommend code. The SP is capable of both.

For communication you have to hook the ESP to a wireless node. here's good resource https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-arduino-ide