Hy
I have problem with arduino leonardo ETH
My project exemple modbus is attachment .
When i change library ethernet.h with ethernet2.h compile error
Help me
MgsModbus_test.ino (3.23 KB)
Hy
I have problem with arduino leonardo ETH
My project exemple modbus is attachment .
When i change library ethernet.h with ethernet2.h compile error
Help me
MgsModbus_test.ino (3.23 KB)
And what error might that be?
Attachments error
error.txt (24.3 KB)
Try restarting the Arduino IDE.
I restart arduino Leonardo ETH , but problem is ETHERNEt2.
When i Build with library ethernet.h problem is not present
I said restart the Arduino IDE, not the Arduino ETH. The Arduino IDE is the Arduino software running on your computer, to restart it do File > Quit and then start the IDE again.
Hello
I restarted arduino ideas (I know arduino)
But the problem persists
Hello,
I have the same problem.
I am trying to run Modbus Library for Arduino lamp example on Arduino Leonardo ETH.
/*
Modbus-Arduino Example - Lamp (Modbus IP)
Copyright by André Sarmento Barbosa
http://github.com/andresarmento/modbus-arduino
*/
#include <SPI.h>
#include <Ethernet.h>
#include <Modbus.h>
#include <ModbusIP.h>
//Modbus Registers Offsets (0-9999)
const int LAMP1_COIL = 100;
//Used Pins
const int ledPin = 9;
//ModbusIP object
ModbusIP mb;
void setup() {
// The media access control (ethernet hardware) address for the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// The IP address for the shield
byte ip[] = { 192, 168, 1, 120 };
//Config Modbus IP
mb.config(mac, ip);
//Set ledPin mode
pinMode(ledPin, OUTPUT);
// Add LAMP1_COIL register - Use addCoil() for digital outputs
mb.addCoil(LAMP1_COIL);
}
void loop() {
//Call once inside loop() - all magic here
mb.task();
//Attach ledPin to LAMP1_COIL register
digitalWrite(ledPin, mb.Coil(LAMP1_COIL));
}
This code compiles without error. But when I change "#include <Ethernet.h>" to "#include <Ethernet2.h>" to use the new Ethernet library I get the same list of multiple definitions:
libraries\Ethernet\Dhcp.cpp.o (symbol from plugin): In function `DhcpClass::reset_DHCP_lease()':
(.text+0x0): multiple definition of `DhcpClass::reset_DHCP_lease()'
libraries\Ethernet2\Dhcp.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Ethernet\Dhcp.cpp.o (symbol from plugin): In function `DhcpClass::reset_DHCP_lease()':
(.text+0x0): multiple definition of `DhcpClass::presend_DHCP()'
libraries\Ethernet2\Dhcp.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Ethernet\Dhcp.cpp.o (symbol from plugin): In function `DhcpClass::reset_DHCP_lease()':
(.text+0x0): multiple definition of `DhcpClass::getLocalIp()'
libraries\Ethernet2\Dhcp.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Ethernet\Dhcp.cpp.o (symbol from plugin): In function `DhcpClass::reset_DHCP_lease()':
(.text+0x0): multiple definition of `DhcpClass::getSubnetMask()'
libraries\Ethernet2\Dhcp.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Ethernet\Dhcp.cpp.o (symbol from plugin): In function `DhcpClass::reset_DHCP_lease()':
(.text+0x0): multiple definition of `DhcpClass::getGatewayIp()'
...
Is there any solution or I must use Ethernet.h (not Ethernet2)?
Do this:
#include <Ethernet.h>
to:
#include <Ethernet2.h>
@Bettybetty, sorry I didn't figure that out back when you were having this problem.
Thank you!