Send sensor data to an IP address

Hello,

I’m trying to upload my sensor data to a certain IP address and sadly can’t figure it out how myself.
The IP would be http://192.168.1.5/index.php

The scetch:

#include <DHT.h>
#define DHT1PIN 2
#define DHT1TYPE DHT22
DHT dht1(DHT1PIN, DHT1TYPE);






void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);

Serial.println("DHT22 Saal 1");

dht1.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
float h1 = dht1.readHumidity();
float t1 = dht1.readTemperature();

if (isnan(t1) || isnan(h1)) {
  
Serial.println("Viga 1. anduri lugemisel"); }
else {

Serial.print("Humidity 1: ");
Serial.print(h1);
Serial.print(" %\t");
Serial.print("Temperature 1: ");
Serial.print(t1);
Serial.println(" 'C");   }
}

One more question: Is it possible to mirror the data from arduino’s serial monitor to the web?
Using leonardo ETH
Thanks,
serka22

So you have some temperature and humidity data logged (or real time) and you want that to appear on a web page (either at home or anywhere in the world), right?

Firstly, you don't (usually) push the data to anywhere; the browser request goes and gets the data (and potentially the entire web page) from a server that the Arduino (via an ESP8266 module, for example) is hosting (eg on 192.168.1.10 - although this is not reachable anywhere except on your local [home] network).

You should read up on the ESP8266 (zillions of examples here) that show you how to run a simple web server that you can then connect to from a browser. You need to have a fundamental knowledge of HTTP and HTML just to understand the examples.

Then try the standard "Switch the LED on and off and display the state on my browser" and get that working. Once you have done this you will suddenly understand what it's all about, I'm guessing.

When you have some specific questions on how to achieve certain things then do post back; what you are seeking to do is, like most things, simple when you know how!

The IP would be http://192.168.1.5/index.php

The protocol to use, the IP address of the server, and the name of the script to use are ALL contained in what you are calling the IP address.

DHT dht1(DHT1PIN, DHT1TYPE);






void setup() {

You

need

to

get

your

enter

key

fixed.

its

sticking.

sadly can't figure it out how myself.

You don't even have anything in the code that suggests that you even have the needed hardware to send data to the internet.

Is it possible to mirror the data from arduino's serial monitor to the web?

No.

Ralph_S_Bacon: So you have some temperature and humidity data logged (or real time) and you want that to appear on a web page (either at home or anywhere in the world), right?

Firstly, you don't (usually) push the data to anywhere; the browser request goes and gets the data (and potentially the entire web page) from a server that the Arduino (via an ESP8266 module, for example) is hosting (eg on 192.168.1.10 - although this is not reachable anywhere except on your local [home] network).

You should read up on the ESP8266 (zillions of examples here) that show you how to run a simple web server that you can then connect to from a browser. You need to have a fundamental knowledge of HTTP and HTML just to understand the examples.

Then try the standard "Switch the LED on and off and display the state on my browser" and get that working. Once you have done this you will suddenly understand what it's all about, I'm guessing.

When you have some specific questions on how to achieve certain things then do post back; what you are seeking to do is, like most things, simple when you know how!

Thanks for the reply, I'll look into it.

@PaulS I did mention that I'm using Leonardo ETH