I am here today because I would like to have some help with my project that I am currently working on.
For this project, I need to send several informations taken by my different sensors connected to my Arduino ATmega 2560.
I bought an ESP8266, did the necessary manipulations to connect it to my network.
And I'm stuck at this point, I don't know how to send different values to my server (server made in node.js). I saw that there was a library "ESP8266Wifi.h" but I wonder if I can use it in addition to my Arduino. Can I use this library with my Arduino mega2560 to send values to my web server?
The question is what protocol does your server expect the data to be send?
MQTT is a protocol developed for sending sensor data around. It is runs on top of TCP/IP and is supported by libraries available for Arduino. With this protocol you can send data to small private server solution based on a Raspberry PI, clouds solutions or anything in between.
Also please let us know what exact hardware you are using. The ESP8266 can is available in different form factors.
OK, so you have a module intended to be used with a microcontroller. The chip itself could run your entire software but then the module does not have the I/O available to do much stuff.
I bought an ESP8266, did the necessary manipulations to connect it to my network.
Does that mean you connected it to your Arduino and run some example, that connects the system to your Wifi? That would be a good start.
Many of the libraries for Arduino are very similar. The function calls are sometimes a bit different and the header files have different names.
So if you have attached the chip to your network that means you installed some wifi libraries for your device. The libraries come with examples, they are usually under File -> Examples if the library was installed correctly and is packaged properly. Otherwise see what is in the sub folder of the libraries.
See if there is a WebClient Example. That will get you started.
If not, have a look at other libraries e.g. for Ethernet of other WiFi products. e.g. the WiFi101 from Arduino. Then try to port the example to your board. e.g. use the initialization you already have, check the function calls used and see if they are the same in your library for the ESP8266.
Donel:
And I'm stuck at this point, I don't know how to send different values to my server (server made in node.js). I saw that there was a library "ESP8266Wifi.h" but I wonder if I can use it in addition to my Arduino. Can I use this library with my Arduino mega2560 to send values to my web server?
I would expect that the name of the library is giving away that answer quite obviously...
You need to have your Arduino Mega communicate the values to be sent to your ESP8266 module (Serial is probably the easiest for this - see also this tutorial), which in turn can send it over http to your web server. Start with this tutorial to get a better understanding of how this processor works and what you can do with it.
Remember to use a proper power supply (the 3.3V of the Arduino won't do) and a level shifter (voltage divider) on the Arduino TX to ESP RX line.