Chat freely about anything...

User avatar
By ViictorG1
#66198 Hi,

I'm needing help to build a project and I'm looking to use a library for my ESP8266 module in my ARDUINO UNO.

If you know a Library to use the ESP8266 I appriciate it.

I need the arduino reading the DB every time to receive a simple value 0 or 1, I just need to know how to receive this answer.

portaoeletronico.esy.es/recebe.php (I NEED TO READ THIS BODY)

At the moment I am not able to make a code on the arduino with this library: https://github.com/itead/ITEADLIB_Arduino_WeeESP8266

That makes the GET request work, could someone show me a code that would work? Thank you.

My PHP:

Code:
Code: Select all<?php
 $servername = "mysql.hostinger.com.br";
 $username = "root";
 $password = "*****";
 $dbname = "esp1";
 $conn = new mysqli($servername, $username, $password);
 
 header("content-type: application/json");

 $sql = "SELECT  * FROM `u582151594_esp82`.`esp1`";
 $result = $conn->query($sql);
 while($data = $result->fetch_object()) {
  $value = $data->value;     
 }
 
 echo '{"value":';
 echo $value;
 echo '}';
 
 $conn->close();
?>


The code returns me:
{"value":0}

I need the arduino to read this JSON, parse, and remove this VALUE for me to use in my code.

Some help?

Thankss