ethernet lib use


I am attempting to migrate a working sketch from mega2560 to teensy, things not going so well, although it does build ok. my trouble is the server will init correctly, and ping, but when I try to query the fixed IP address, the serial monitor goes crazy. ping still works(so the code is running), but the web page just doesn't respond.

I note in the build there are multiple ethernet libs, and the ide picks the auduino one instead of the teensy one even though I have teensy selected in the board menu. How can I get the ide to use the teensy lib?

Multiple libraries were found for "EthernetClient.h" Used: C:\Users\twilkers\Documents\Arduino\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Ethernet

Seems fairly simple. What ethernet library is here?

If you don’t use that one, move or delete it and move your teensy ethernet library there.

As long as the architecture value in matches the library in your sketchbook folder(in your case C:\Users\twilkers\Documents\Arduino\libraries) will always take include priority over libraries of the same name installed in other locations. This is useful for making custom libraries but the problem is Library Manager also installs to the sketchbook folder. which is probably the source of your problem unless you intentionally installed it there. There's been a lot of effort by the 3rd party hardware developers to get the Arduino developers to do something about this but they only did a fix that stops it from affecting their own hardware and then closed the issue so it looks like this is something we will be dealing with for the foreseeable future.

If you deleted C:\Users\twilkers\Documents\Arduino\libraries\Ethernet the Teensy library would be used when a Teensy board is selected and the Arduino library will be used when an Arduino board is selected. If there is a newer version of the Ethernet library available in Library Manager than the one included with your Arduino IDE installation(like if you have an old IDE version) then the library will show as updatable and you may get update notifications if you have them enabled.

The only potential problem with SurferTim's solution is that the Teensy library will also be used for Arduino AVR Boards such as your Mega so if it doesn't support those boards that's an issue but my guess is the Teensy library should support the Mega as well and from a quick look at the source code that appears to be the case. The Teensy Ethernet library actually has the nice feature of supporting W5100 and W5200 Ethernet controller chips with automatic detection(Arduino Ethernet only supports W5100).