Closed bimcas closed 8 years ago
You're using the older library and that is not going to work. The library on LP is not the current version. The one on GitHub is the latest. Download it using the library manager in the Arduino IDE.
If the Ethernet library you mentioned is truly compatible in that it has the same classes with the same methods that the Arduino Ethernet library has, you can use it with the latest version of the connector.
Hello,
I have Arduino UNO and ENC28J60 - Ethernet Controllers (http://store.iteadstudio.com/images/produce/Shield/ENC28j6_Ethernet_Interface_Module/Ethernetmodule1.jpg). I downloaded EtherCard library for the ENC28J60 Ethernet Controllers, compatible with Arduino IDE (http://jeelabs.org/pub/docs/ethercard/). Arduino with Ethernet Controller is working perfectly (DHCP, DNS services nd etc.).
Then I tried to use MySQL connector library (https://launchpad.net/mysql-arduino) connect to MySQL Server. My code below:
include "EtherCard.h"
include "sha1.h"
include "mysql.h"
/* Setup for Ethernet Library */ byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress server_addr(10, 0, 0, 1); byte Ethernet::buffer[700];
/* Setup for the Connector/Arduino */ Connector my_conn; // The Connector/Arduino reference char user[] = "my_user"; char password[] = "sssssii"; void setup() { Serial.begin(9600); while (!Serial); Serial.println("Connecting to network...."); ether.begin(sizeof Ethernet::buffer, mac_addr, 8); Serial.print("Connecting to MySQL...."); if (my_conn.mysql_connect(server_addr, 3306, user, password)){ Serial.println("Success!"); } else { Serial.println("Connection failed."); } } void loop() { }
This code isn't working and I'm getting error messages: In file included from C:\Arduino\libraries\mysql_connector/mysql.h:40:0, from C:\Arduino\sketch_MySQL2\sketch_MySQL2.ino:12: C:\Arduino\libraries\Ethernet\src/Ethernet.h:39:22: error: 'EthernetClass Ethernet' redeclared as different kind of symbol extern EthernetClass Ethernet; ^ In file included from C:\Arduino\sketch_MySQL2\sketch_MySQL2.ino:1:0:
C:\Arduino\libraries\ethercard-master/enc28j60.h:187:18: error: previous declaration of 'typedef class ENC28J60 Ethernet' typedef ENC28J60 Ethernet; //!< Define alias Ethernet for ENC28J60 ^ exit status 1 Error compiling.
I tried many combinations of this code, also other libraries of ENC28J60 and MySQL connectors, but no result. I think ENC28J60 libraries and MySQL connector libraries are not compatible with each other.
Do you have any idea? How to fix those problems? ENC28J60 - Ethernet Controllers are quite popular. It will be great if MySQL connector libraries will be compatible with them.
Thanks