1

I am trying to update a db table using a WIFI Bee.

For the life of me, I can't figure out how to connect to and program the WiFi Bee ESP card. I've looked on DFRobot's website and other websites to no avail.

The PHP code is

try {
        include "../Common/ConnectionStringArduino.php"; // Create a connection

        // Update state
        $sql    = "Update `Status` SET `DateTime`='".time()."',`State`='".$_GET["CurrentState"]."' WHERE `Device`='Arduino';";
        $result = $con->query( $sql ); if($result === FALSE) { die(mysqli_error());}
        mysqli_close($con);
        echo "Success";
    } catch (Exception $e) {
        echo "Error";
    };

If i call the page by typing the URL of this page on a browser window it updates the database on a Raspberry Pi but so far I had no luck in doing it via the WiFi Bee module.

I have a Rome v2 board with inbuilt WiFi Bee socket.

I am familiar with AT commands (but not a ginus)

My Arduino code

#include "esp8266.h"

#define ssid "XXX"
#define pass "YYY" 
Esp8266 wifi;

void setup() {
  delay(2000);            // It will be better to delay the setup for 2 seconds for esp8266 module to initialize
  Serial.begin(9600);     // Terminal serial port baud rate for USB debugging on the pc serial monitor
  Serial1.begin(115200);  // Xbee Serial port baud rate should be set the same to 115200

  // Items for WiFi Communication
  wifi.begin(&Serial1, &Serial);    // Setup the WiFi to use Setial1 and Serial to debug
  if (wifi.connectAP(ssid, pass)){  // Connect to the AP
    wifi.debugPrintln("Connection to AP sucessful!");
  } else {
    while(true);
  };
  wifi.debugPrintln("esp8266 ip:" + wifi.getIP());
  wifi.setSingleConnect();
  if (wifi.connectTCPServer("192.168.1.17", "80")) { wifi.debugPrintln("Connection to Pi Successful!");}      
  else                                             { wifi.debugPrintln("Connection to Pi Failed!!!");};
}

void loop(){
  if(Serial1.available()) {
   ....
   For god sake how do I call this page : "http://192.168.1.17/Arduino/IAmAlive.php?CurrentState=1" to update the database entry using this beeeeeee
   ....
  }
}

The bee gets an IP upon successful connection

Connection to AP successful!
esp8266 ip:192.168.1.23

and i can ping the bee

Reply from 192.168.1.23: bytes=32 time=78ms TTL=255
Reply from 192.168.1.23: bytes=32 time=99ms TTL=255
Reply from 192.168.1.23: bytes=32 time=25ms TTL=255
Reply from 192.168.1.23: bytes=32 time=6ms TTL=255

But have no idea how to call the page to update the db. I have read endless blogs with no luck of solving my simple issue

Please help

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.