Estou utilizando um Mega 2560 e uma Ethernet Shield, conectada com o cabo diretamento com meu pc, pra enviar alguns dados para um banco de dados MySQL, porém o conn.connect(server_addr, 3306, user, password) sempre parece retornar falso
#include <Ethernet.h>
#include <MySQL_Connection.h>
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(200,129,38,54); // IP of the MySQL *server* here
char user[] = "root"; // MySQL user login username
char password[] = "root"; // MySQL user login password
EthernetClient client;
MySQL_Connection conn((Client *)&client);
void setup() {
Serial.begin(9600);
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);
Serial.println("Conectado");
// You would add your code here to run a query once on startup.
}
else
Serial.println("Connection failed.");
conn.close();
}
void loop() {
}