Arduino > photon library

Hi there I’m new to particle.
I am trying to convert a library that’s for the Arduino to be used by the photon.
In the library it includes the Arduino ethernet and or wifi library, obviously the photon does not use/require this so how would I replace with a photon equivalent?

#if defined(PubNub_Ethernet)
#include <Ethernet.h>
#define PubNub_BASE_CLIENT EthernetClient

What should the PubNub_BASE_CLIENT be equal to?

You won’t need them :wink:

Sure I Kinda get that but PubNub_BASE_CLIENT is referenced throughout the current library so surely I need to point that at something on the photon end?

Hi @lindstrom1989

There is no Particle class that is a direct substitute for EthernetClient. The TCPClient class or the TCPServer class are probably what you want to use but I would look at each method call and see if it makes sense.

Ok I’ll give it a try, where does that class come from? is it an external library? thanks

Hi @lindstrom1989

Both the TCPClient and TCPServer classes are built-in and you don’t need any include in the webIDE. In a C++ library you should do #include "application.h" to get them. This include could change names in the future. You can use various #ifdef macros to make your library more portable or you can make a Particle-specific version.

1 Like