Go Down

Topic: connect pic with arduino (Read 392 times) previous topic - next topic

marios_

Dec 05, 2012, 01:23 pm Last Edit: Dec 05, 2012, 01:47 pm by marios_ Reason: 1
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.
Code: [Select]

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

Groove

What's the problem?
Have you connected the grounds together?
Per Arduino ad Astra

wildbill

Quote
I tried this code but without result.

What were you expecting?

PaulS

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?

Graynomad

Quote
I tried this code but without result.

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

Code: [Select]
if (val == HIGH) {
// execution of this command
}


What did you expect to see from a comment?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy