trying to print out the bits of the communication

I have an ethernet shield connected to my uno. My goal is to print out the real time binary state (1 or 0) of my arduino pins 10~13, every time there's a change in state ie any time there's communication going on.

...but it doesn't work, please help! thanks in advance :slight_smile:

void setup()
{

//(connection already made)

  for(int i=10; i<=13 ;i++)
  {
      pinMode(i,INPUT);
  }
  Serial.println();
  ////////////////////////////////////////////////////
  
  
}

void loop()
{
  int j=0, hi, by;

  
  for(int i=10; i<=13 ;i++)
  {
          hi = digitalRead(i);
     
          if(j==0)
          {by=hi;}

          if(hi!=by && j>0)
          {
              Serial.print(i);
              Serial.print(": ");
              Serial.println(hi);
              Serial.println("\n");
          }

      
  }

  
  j++;
  by = hi;
}

i was hoping for Serial output to print like crazy when i pinged or telnetted into the ethernet shield; i can telnet into it, but nothing prints on the serial output.

You don't have a Serial.begin()

i included the Serial.begin(9600); but still nothing printed :frowning:

Did you put something in setup() to print, as in "Hello world" so that you can isolate the problem to not printing at all, or to having something to do with your logic or networking?