Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino MKR1010 Connection Issue #90

Closed
Ch4rlesB opened this issue Mar 13, 2019 · 6 comments
Closed

Arduino MKR1010 Connection Issue #90

Ch4rlesB opened this issue Mar 13, 2019 · 6 comments

Comments

@Ch4rlesB
Copy link

I have a arduino mkr1010 board with integrated wifi.

It uses WifiNINA instead of WiFi library.
I know the credentials and port are correct because I can connect to the DB via a java script I wrote.
I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010?

*/
#include <WiFiNINA.h> // Use this for WiFi instead of Ethernet.h
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>

IPAddress server_addr(127,0,0,1); // IP of the MySQL server here
char user[] = "admin"; // MySQL user login username
char password[] = "secret"; // MySQL user login password

// WiFi card example
char ssid[] = "BdeB"; // your SSID
char pass[] = ""; // your SSID Password

WiFiClient client; // Use this for WiFi instead of EthernetClient
MySQL_Connection conn((Client *)&client);

void setup() {
Serial.begin(115200);
while (!Serial); // wait for serial port to connect. Needed for Leonardo only

// Begin WiFi section
int status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
// print out info about the connection:
else {
Serial.println("Connected to network");
IPAddress ip = WiFi.localIP();
Serial.print("My IP address is: ");
Serial.println(ip);
}
// End WiFi section

Serial.println("Connecting...");
if (conn.connect(server_addr, 33060, user, password)) {
delay(1000);
}
else
Serial.println("Connection failed.");
conn.close();
}

void loop() {
}

@ChuckBell
Copy link
Owner

ChuckBell commented Mar 13, 2019 via email

@Ch4rlesB
Copy link
Author

There are a couple of issues and one potential issue. Did you change the connector code to use WiFiNINA.h? See the #include in the connector code and change it. The connector does not “speak” X Protocol. You must use the older protocol. So, use port 3306, not 33060. Set the server IP to the actual IP, not local host or loopback. The connector won’t work with the loopback address.

On Wed, Mar 13, 2019 at 10:27 CharlesBarette @.***> wrote: I have a arduino mkr1010 board with integrated wifi. It uses WifiNINA instead of WiFi library. I know the credentials and port are correct because I can connect to the DB via a java script I wrote. I can connect to my wifi but it never connects to the DB. Is there an issue with the fact I am using the mkr1010? */ #include <WiFiNINA.h> // Use this for WiFi instead of Ethernet.h #include <MySQL_Connection.h> #include <MySQL_Cursor.h> IPAddress server_addr(127,0,0,1); // IP of the MySQL server here char user[] = "admin"; // MySQL user login username char password[] = "secret"; // MySQL user login password // WiFi card example char ssid[] = "BdeB"; // your SSID char pass[] = ""; // your SSID Password WiFiClient client; // Use this for WiFi instead of EthernetClient MySQL_Connection conn((Client *)&client); void setup() { Serial.begin(115200); while (!Serial); // wait for serial port to connect. Needed for Leonardo only // Begin WiFi section int status = WiFi.begin(ssid, pass); if ( status != WL_CONNECTED) { Serial.println("Couldn't get a wifi connection"); while(true); } // print out info about the connection: else { Serial.println("Connected to network"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); } // End WiFi section Serial.println("Connecting..."); if (conn.connect(server_addr, 33060, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close(); } void loop() { } — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#90>, or mute the thread https://github.com/notifications/unsubscribe-auth/AH0j4PkMR0QorVpEP_kab8XrSSYDaoyYks5vWQrhgaJpZM4btW09 .

I changed from my schools DB to a local database to be able to use port 3306.
I also got my computers ip and changed it to that.

Where does one find the connector code?

@ChuckBell
Copy link
Owner

ChuckBell commented Mar 13, 2019 via email

@Ch4rlesB
Copy link
Author

I have in the library folder, MySQL_connection.h and MySQL_connection.cpp and in none can I find an include with something I would replace with the WiFiNINA

@ChuckBell
Copy link
Owner

ChuckBell commented Mar 14, 2019 via email

@ChuckBell
Copy link
Owner

Closed due to inactivity. Please open a new ticket if this is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants