connect pic with arduino

Hello guys
I want to connect my pic18f with arduino mega. when i sent HIGH from the pic i want arduino to read it and and execute a command. Can you help me with the code please.
I tried this code but without result.

int inPin = 22;   // choose the input pin 
int val = 0;     // variable for reading the pin status
void setup() 
{
pinMode(inPin, INPUT); 
}
void loop()
{
val = digitalRead(inPin);  // read input value
if (val == HIGH) {
// execution of this command
}
}

Thank you

What's the problem?
Have you connected the grounds together?

I tried this code but without result.

What were you expecting?

That code does something. You expect it to do something. What either of those somethings is is a mystery, though. Ball's back in your court.

You did connect the grounds, right?

I tried this code but without result.

You aren't executing any code when you detect the high input

if (val == HIGH) {
// execution of this command
}

What did you expect to see from a comment?


Rob