Can RangeFinder perform/trigger two operations?

I currently have an ultrasonic range finder programmed to turn a servo within a distance <20. I also want this same sensor to operate my LEDs and was wondering if I can have that operation run in tandem?

The LEDs are on a separate arduino and are programmed to operate in succession as an individual comes closer and closer to the object. Therefore, I need the sensor to fire each specified pin for the LEDs as indicated, but still turn the motor. How can I combine these functions?

Thanks.

example code for LED using serial.print:

if (howfar < 50) { // start of in range actions
if (howfar > 40) { // "far"
digitalWrite(9, HIGH); // sets the red LED on
}
else if (howfar > 20) // "medium"
{
digitalWrite(10, HIGH); // sets the yellow LED on
}
else // "near"
{
digitalWrite(11, HIGH); // sets the green LED on
}
} // end of in-range actions

make a function out of it and call it wherever you like. You forgot to switch off the leds.

#define REDLED 9
#define YELLOWLED 10
#define GREENLED 11

void doLeds(int howfar)
{
  digitalWrite(REDLED , LOW);
  digitalWrite(YELLOWLED , LOW);
  digitalWrite(GREENLED , LOW);

  if (howfar >= 50) return;
  if (howfar > 40) 
  {
    digitalWrite(REDLED , HIGH);
    return;
  } 
  if (howfar > 20) 
  {
    digitalWrite(YELLOWLED , HIGH); 
    return; 
  }
  digitalWrite(GREENLED , HIGH);   
  return;
}