#include <ESP8266WiFi.h>
const char* ssid = "xxxx";
const char* password = "xxxxxxxxxx";
const char* host = "192.168.43.18";
const int ldr = A0;
int val = 0;
void setup()
{
Serial.begin(9600);
Serial.println();
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println(" connected");
}
void loop()
{
val = analogRead(ldr);
WiFiClient client;
Serial.printf("\n[Connecting to %s ... ", host);
if (client.connect(host, 80))
{
Serial.println("connected]");
client.println("POST /past.php HTTP/1.1");
client.println("Host: 192.168.43.10");
client.print(val);
Serial.println(val);
Serial.println("\n[Disconnected]");
}
else
{
Serial.println("connection failed!]");
client.stop();
}
delay(5000);
}
I have uploaded this code to node mcu but it get's working but the uploaded data in my database is not shown please any one help me out
val
(its string representation, not sizeof int!).