Ethernet library disable ouput pin Arduino Uno

Hi guys,
I upload this sketch on my arduino uno:

#include <SPI.h>
#include <Ethernet.h>
#include <TinkerKit.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 14, 201);
EthernetServer server(5000);

TKMosFet relay(O0);
int led = 13;

void setup()
{
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.println("Server is running");
  Serial.println(Ethernet.localIP());
}

String message = "";

void loop()
{
  EthernetClient client = server.available();
  if(client == true)
  {
    while(client.connected())
    {
      if(client.available())
      {
        char c = client.read();
        if(c != '\n')
        {
          message += c;
        }
        else
        {
          // Serial.println(message);  
           delay(500);
           Serial.println("Message from pc: " + message);
           Serial.println("Sending data to client...");
           client.println(message);
           delay(1000);
        }
      }
    }
    
    if(message == "ON")
    {
      Serial.println("Message is ON");
      digitalWrite(led, HIGH);
    }
    else if (message == "OFF")
    {
      Serial.println("Message is OFF");
      digitalWrite(led, LOW);
    }
    else
    {
      Serial.println("Message is not recognized as command. Received: " + message);
    }
    
    delay(500);
    message = "";
    Serial.println("Reinitializing message...");
    delay(2000);
    client.stop();
  }
  delay(500);
}

The result is that tcp messaging are sent and received correctly, but digitalWrite(led, HIGH); and digitalWrite(led, LOW); not power on/off the led on that pin.

I try also to eliminate much code:

#include <SPI.h>
#include <Ethernet.h>
#include <TinkerKit.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 14, 201);
EthernetServer server(5000);

TKMosFet relay(O0);
int led = 13;

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);  
}
void loop()
{
}

…but again pin 13 stays low.

Last trial that i do is:

#include <SPI.h>
#include <Ethernet.h>
#include <TinkerKit.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 14, 201);
EthernetServer server(5000);

TKMosFet relay(O0);
int led = 13;

void setup()
{
  //Ethernet.begin(mac, ip);    <------- not initializing Ethernet class
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);  
}
void loop()
{
}

and with that code led sitched on.

Please help me to understand what’s goes wrong :frowning:

(deleted)

spycatcher2k:
SPI Uses pin 13 - it’s unavailable for you to use.

Thank you very much for your reply, but I cannot resolve the problem.
For a more clear explaination i re-edit and test my sketches like this:

case 1) OK. Relay goes HIGH for 2 sec and LOW for other 2 secs (nothig special here I know…)

#include <SPI.h>
#include <Ethernet.h>
#include <TinkerKit.h>

TKRelay relay(O0);

void setup()
{
  Serial.begin(9600);  
}

void loop()
{
   relay.on();
   delay(2000);
   relay.off();
   delay(2000);
}

case 2) KO. Relay attached on output pin O0 remains at HIGH level.

#include <SPI.h>
#include <Ethernet.h>
#include <TinkerKit.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 14, 201);
EthernetServer server(5000);

TKRelay relay(O0);

void setup()
{
  Serial.begin(9600);
  Ethernet.begin(mac, ip);
  //server.begin();
  //Serial.println("Server is running");
  //Serial.println(Ethernet.localIP()); 
}
void loop()
{
   relay.on();
   delay(2000);
   relay.off();
   delay(2000);
}

I guess that in case 2) it seems that the Ethernet Object from Ethernet library conflicts with I/O operation.

Hardware attached.

(deleted)

spycatcher2k:
I've never heard of O0 ?

It's Output 0 on tinker kit Shield http://www.tinkerkit.com/shield/

(deleted)

spycatcher2k:
OK - Pins 11,12 & 13 are used by SPI - These are not available to use if you have an SPI device hooked up.

$) Thank you very much man! I solve problem by change output pin!
Have a nice day.