Arduino Forum

Using Arduino => Programming Questions => Topic started by: Asteroth on Mar 23, 2017, 07:47 pm

Title: The standard MySQL examples on atmega328 do not work
Post by: Asteroth on Mar 23, 2017, 07:47 pm
I use the standard examples on using MySQL on iboard v1.1 atmega328, Converter Foca FT232RL USB - UART





/*
  MySQL Connector/Arduino Example : connect

  This example demonstrates how to connect to a MySQL server from an
  Arduino using an Arduino-compatible Ethernet shield. Note that "compatible"
  means it must conform to the Ethernet class library or be a derivative
  thereof. See the documentation located in the /docs folder for more
  details.

  INSTRUCTIONS FOR USE

  1) Change the address of the server to the IP address of the MySQL server
  2) Change the user and password to a valid MySQL user and password
  3) Connect a USB cable to your Arduino
  4) Select the correct board and port
  5) Compile and upload the sketch to your Arduino
  6) Once uploaded, open Serial Monitor (use 115200 speed) and observe

  If you do not see messages indicating you have a connection, refer to the
  manual for troubleshooting tips. The most common issues are the server is
  not accessible from the network or the user name and password is incorrect.

  Note: The MAC address can be anything so long as it is unique on your network.

  Created by: Dr. Charles A. Bell
*/
#include <Ethernet.h>
#include <MySQL_Connection.h>

byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(10,0,1,35);  // IP of the MySQL *server* here
char user[] = "root";              // MySQL user login username
char password[] = "secret";        // 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() {
}

After the compilation, here's what message


Build options changed, rebuilding all
Sketch uses 15754 bytes (48%) of program storage space. Maximum is 32256 bytes.
Global variables use 863 bytes (42%) of dynamic memory, leaving 1185 bytes for local variables. Maximum is 2048 bytes.
Invalid library found in C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________: C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________
Invalid library found in C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________: C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________


And when I to do the serial port monitoring, there is nothing.
Title: Re: The standard MySQL examples on atmega328 do not work
Post by: PaulS on Mar 23, 2017, 07:54 pm
Quote
there is nothing.
Not even the "Connecting" message?
Title: Re: The standard MySQL examples on atmega328 do not work
Post by: Asteroth on Mar 23, 2017, 08:45 pm
Quote
Not even the "Connecting" message?
Yes. If i creat simple anolog input test.. all good.

Problem in this message

Invalid library found in C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________: C:\Users\Dmitriy\Documents\Arduino\libraries\Test_________


What kind of problem and what kind of library does he not like?
Title: Re: The standard MySQL examples on atmega328 do not work
Post by: Asteroth on Mar 25, 2017, 11:48 am
Have any suggestions?