user6353: I am trying to control an Arduino Leonardo R3 to run some code when "triggered" from a Raspberry Pi. This would be in a loop so that it can be run multiple times. I have set up the Raspberry Pi and tested it with an LED and the output is working fine.
I then connected this to the Arduino and checked for a HIGH input from the RPi using an if statement.
void setup() {
  pinMode(7,INPUT);
  if(digitalRead(7)==HIGH) {
    // CODE IN HERE
  }
}

I found that this did not work as the if statement was always true because of pullup resistors not being used. I would greatly appreciate some guidance on this.

user4775: I don't have much experience about Arduino boards connected to the Pi, never tried anything other than Arduino Due, but I do have some experiences with ATmega328P directly attached to the Pi. The ATmega is clocked at 12MHz instead of 16 to guarantee a stable state at 3.3V supply voltage.
Physical connection takes 5 signal wires besides the 3.3V power rail, with the ATmega talking with the Pi over SPI as a slave device, using both slave select lines, one at the SS pin and the other at RESET pin. This allows communication over proper hardware interfaces while eliminates the need of a programmer or preprogrammed chips as the ATmega use its SPI interface as ICSP, this setup essentially keep ICSP properly wired to the Pi at all times. An additional pin can be used as a IRQ pin from the ATmega to the Pi.
About the protocol that part is up to yourself. There are endless possibilities and you can implement anything that fits your need and easy to use.

user27687: I have done this in a different manner.
I have used the UART TX pin of RPi connected to the RX pin of the arduino and sent serial messages from Arduino to RPi.
That worked fine.
But the thing is, what you have done is correct and has to work. 
Please make sure that you have connected Arduino's ground and RPi ground together.

If you not do that and try the same code it has to work. Because the RPi and Arduino are in two different circuits, so in order to work, make them one make GROUND common.

user6365: You have to verify, at least: 
A. if the 3.3V of the RPi can be read as high on the Atmega, if so you can connect them without any resistor.
B. if not, you have to use a voltage adapter (yes, other components and many possible solutions), otherwise you RPi GPIO will be ruined if using a pullup on the 5V. 
The pullup and pulldown, in this case, should be used when you are in A and the peripheral support the higher voltage. This is not the case.

6353: <p>I am trying to control an Arduino Leonardo R3 to run some code when "triggered" from a Raspberry Pi. This would be in a loop so that it can be run multiple times. I have set up the Raspberry Pi and tested it with an LED and the output is working fine.</p>

<p>I then connected this to the Arduino and checked for a HIGH input from the RPi using an if statement.</p>

<pre><code>void setup() {
  pinMode(7,INPUT);
  if(digitalRead(7)==HIGH) {
    // CODE IN HERE
  }
}
</code></pre>

<p>I found that this did not work as the if statement was always true because of pullup resistors not being used. I would greatly appreciate some guidance on this.</p>
 4775: <p>I don't have much experience about Arduino boards connected to the Pi, never tried anything other than Arduino Due, but I do have some experiences with ATmega328P directly attached to the Pi. The ATmega is clocked at 12MHz instead of 16 to guarantee a stable state at 3.3V supply voltage.</p>

<p>Physical connection takes 5 signal wires besides the 3.3V power rail, with the ATmega talking with the Pi over SPI as a slave device, using both slave select lines, one at the SS pin and the other at RESET pin. This allows communication over proper hardware interfaces while eliminates the need of a programmer or preprogrammed chips as the ATmega use its SPI interface as ICSP, this setup essentially keep ICSP properly wired to the Pi at all times. An additional pin can be used as a IRQ pin from the ATmega to the Pi.</p>

<p>About the protocol that part is up to yourself. There are endless possibilities and you can implement anything that fits your need and easy to use.</p>
 27687: <p>I have done this in a different manner.</p>

<p>I have used the UART TX pin of RPi connected to the RX pin of the arduino and sent serial messages from Arduino to RPi.</p>

<p>That worked fine.</p>

<p>But the thing is, what you have done is correct and has to work. </p>

<p>Please make sure that you have connected Arduino's ground and RPi ground together.</p>

<hr>

<p>If you not do that and try the same code it has to work. Because the RPi and Arduino are in two different circuits, so in order to work, make them one make GROUND common.</p>
 6365: <p>You have to verify, at least: </p>

<p>A. if the 3.3V of the RPi can be read as high on the Atmega, if so you can connect them without any resistor.</p>

<p>B. if not, you have to use a voltage adapter (yes, other components and many possible solutions), otherwise you RPi GPIO will be ruined if using a pullup on the 5V. </p>

<p>The pullup and pulldown, in this case, should be used when you are in A and the peripheral support the higher voltage. This is not the case.</p>
