Today we’re going to learn how to connect ESP8266 to website that store the inputs to MySQL.
To help you, I have created the example website here. This tutorial focuses on storing the sensor output to website, while providing the website that already works. Next part would be building the website itself.
This tutorial uses ESP8266 as a microcontroller, for example NodeMCU and Wemos D1.
- Example above are modification of examples “Blink” in Arduino IDE. It will report to website when the LED is on and off every 1 second.
- Make sure you also copy the include part if you’re going to use part of this program somewhere else.
- Remember to change the SSID and Password to your wifi settings.
- If you’re already connected, serial monitor will report your IP.
- Notice the inputweb() function.
- Usage :
- identifier can be used to identify our input. This is public web, so think about something unique.
- On the page ESP8266 Project Test, you can search your identifier using the search box above.
- http://project.rinaldo.id/esp8266/input.php? can be replaced later. But we’re not going to build the website now. This tutorial focuses on building the microcontroller that sends output successfully to the website.
- We’re using GET method to input to the website.
- sensor1 to sensor6 receives input in decimal format. If you’re not going to use it, just replace it with zero, and the char part using empty quotes. Example : :
- this function can be used in other program, receiving proper variables. That’s why we’re making it into function.
- Usage :
- Menghubungkan Nodemcu Dengan Website Database
- Cara Menghubungkan Nodemcu Ke Mysql
- Cara Menyimpan Data Dari Arduino Ke Mysql
- Cara Read Data Nodemcu Dengan Php
- If On Save 1 In Database Esp8266 Php Code