How do I connect Arduino with esp-01 to myphpadmin?

Asked

Viewed 18 times

0

I have a mega Arduino attached to a esp-01 as follows

Arduino-------------esp-01
3v3
gnd------------------gnd
Tx-----------------Tx
Rx-----------------Rx
reset-gnd | en--gnd
|||||||||||||||||||||||||||||||| I00--3v3
||||||||||||||||||||||||||||||||reset-gnd(button)

 #include <Ethernet.h>
    #include <MySQL_Connection.h>
    
    byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    //3C-6A-A7-66-7F-10
    IPAddress server_addr(127, 0, 0, 1);  // IP of the MySQL *server* here
    char user[] = "root";              // MySQL user login username
    char password[] = "12345";        // MySQL user login password
    
    EthernetClient client;
    MySQL_Connection conn((Client *)&client);
    
    void setup() {
      Serial.begin(115200);
      while (!Serial); // wait for serial port to connect
      Ethernet.begin(mac_addr);
      Serial.println("Connecting...");
      if (conn.connect(server_addr, 3306, user, password)) {
        delay(1000);
        // You would add your code here to run a query once on startup.
      }
      else
        Serial.println("Connection failed.");
      conn.close();
    }
    
    void loop() {
    }

I don’t have an Arduino Shield, or esp8266 adapter, so I can’t use the #include <Ethernet library. h>

someone on can help with the code?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.