My ESP8266 is able to connect to my wifi. However, when I tried to included Blynk IOT into my program, the serial monitor keep saying
AT+CIPSTART=1,"TCP","blynk-cloud.com",80
AT+CIPCLOSE=1
it keep repeating this 2 sentences after connected to the wifi. What’s happen? Is it a problem of my code??
Here is my code on Arduino IDE
//Libraries
#include <DHT.h>;
#include <ESP8266_Lib.h>
//#include <ESP8266WiFi.h>;
#include "WiFiEsp.h"
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif
#define DHTPIN 10 // connect the dht output to 10(pwm)
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#define led 8 //connect to led to pin 8-->change to motor later
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
#define BLYNK_PRINT Serial
#include <BlynkSimpleShieldEsp8266.h>
#define EspSerial Serial
#define ESP8266_BAUD 115200
#define BLYNK_TEMPLATE_ID "***"
#define BLYNK_DEVICE_NAME "DHT22"
#define BLYNK_AUTH_TOKEN "";
//Variables
int chk;
float hum; //Stores humidity value
float temp; //Stores temperature value
char ssid[] = ""; //You can replace the wifi name to your wifi
char pass[] = ""; //Type password of your wifi.
int status = WL_IDLE_STATUS; // the Wifi radio's status
char auth[] = "nfxC29MO9ja1n6hzopoqMg2EA56Znw6N";
ESP8266 wifi(&EspSerial);
void setup()
{
// initialize serial for debugging
Serial.begin(115200);
// initialize serial for ESP module
Serial1.begin(115200);
// initialize ESP module
WiFi.init(&Serial1);
pinMode(LED_BUILTIN, OUTPUT);
dht.begin(); //start running the dht
pinMode (led, OUTPUT); //set the led(pin8) as output
pinMode (LED_BUILTIN, OUTPUT); //set the led on board as output
// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
digitalWrite(LED_BUILTIN, LOW); //no on board led if no wifi
Serial.println("WiFi is not connected");
// don't continue
while (true);
}
// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
digitalWrite(LED_BUILTIN, HIGH);//connecting have on board led
Serial.print("Connecting to ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}
// you're connected now, so print out the data
Serial.println("You're connected to the network");
EspSerial.begin(ESP8266_BAUD);
Blynk.begin(auth, wifi, ssid, pass);
}
void loop()
{
delay(2000);
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
Blynk.run();
//Read data and store it to variables hum and temp
hum = dht.readHumidity();
temp = dht.readTemperature();
//Print temp and humidity values to serial monitor(help checking the data)
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
if (temp >= 20) //running the motor with sensor
{
digitalWrite(led, HIGH); //switch on motor
delay(1000);
}
else
{
digitalWrite(led, LOW); //switch off motor
delay(1000);
}
delay(1000); //Delay 2 sec.
}