Using pins 34 ~ 52 as digital read fail

Hi guys. I am trying to use these pins (Arduino Mega 2560) as simple digital read (if one of these pins goes to high level, it sends a message through serial Port). These ports are not working, I have to change to ports 4 ~ 13 to work normally. Is there anything else I could do to use these ports as digital read? Thank you.

You've obviously done something wrong. You should show your project and your code to someone who knows what they are doing and maybe they can help you figure out what you did wrong. This would have been a great place to do that. Not sure why you are just telling us that you have a problem without giving us any chance to help you solve it.

I´m sorry for that. Below is the code, just to remember that if I use the analog pins from 5 ~ 8, it works perfectly as digital input. But when I try to use these pins (38, 40 and 42), it does not work. I tried to switch to a new board, but with no success at all...
The digital pins read 5 volts ou 0 volt from a magnetic sensor connected to 5 volts.

int sensor1 = 38;
int sensor2 = 40;
int sensor3 = 42;
int relay1 = 10;
int relay2 = 11;
int relay3 = 12;

void setup() 
  pinMode(sensor1, INPUT);
  pinMode(sensor2, INPUT);
  pinMode(sensor3, INPUT);
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);

void loop()
  if (sensor1 == HIGH) 
    Serial.print("Sensor #1 activated!");
    digitalWrite(relay1, HIGH);

 if (sensor2 == HIGH) 
    Serial.print("Sensor #2 activated!");
    digitalWrite(relay2, HIGH);

 if (sensor3 == HIGH) 
    Serial.print("Sensor #3 activated!");
    digitalWrite(relay3, HIGH);
if (sensor1 == HIGH)

sensor1 is:

int sensor1 = 38;

and HIGH is 1.

38 will never equal 1. So this is a pretty useless statement. Did you forget to call digitalRead there?

After some hours I could finally fix the problem