function not declared in scope re multiple sensors using ping example

hello I know this problem has come up before and i’ve had a look through at older posts but couldn’t see this specific issue. basically I’m just trying to set up 2 sensors (with a veiw to 6) using the ping example.which will ultimately lead to an installation at a local arts festival.

here is my code

const int pingPin1 = 7;
const int pingPin2 = 2;
void setup() {

  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
  long duration2, inches2, cm2;

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

  inches1 = microsecondsToInches1(duration1);
  inches2 = microsecondsToInches2(duration2);
  cm1 = microsecondsToCentimeters1(duration1);
  cm2 = microsecondsToCentimeters2(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);


}

long microsecondsToInches1(long microseconds1);
long microsecondsToInches2(long microseconds2);

{

}

long microsecondsToCentimeters1(long microseconds1);
long microsecondsToCentimeters2(long microseconds2);

{


  return microseconds1 / 29 / 2;
  return microseconds2 / 29 / 2;
}

but I’m getting “microsecondstoinches1 was not declared in this scope.” I tired declaring them as ints ( a stab in the dark). but got “microsecondstoinches1 cannot be used as a function”.

I also tried

const int pingPin1 = 2;
const int pingPin2 = 7;
void setup() {
  
  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;

 
  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin1, LOW);

 
  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);

 
  inches1 = microsecondsToInches1(duration1);
  cm1 = microsecondsToCentimeters1(duration1);
  
  Serial.print(inches1);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print("cm");
  Serial.println();
  
  if (inches1 >0.00 && inches1 <=10.00) {
    Keyboard.print ("a"); }
  
  delay(100);
}

long microsecondsToInches1(long microseconds1)
{

  return microseconds1 / 74 / 2;
}

long microsecondsToCentimeters1(long microseconds1)
{
  
  return microseconds1 / 29 / 2;




 
 long duration2, inches2, cm2;

 
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin2, LOW);

 
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

 
  inches2 = microsecondsToInches2(duration2);
  cm2 = microsecondsToCentimeters2(duration2);
  
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();
  
  if (inches2 >0.00 && inches2 <=10.00) {
    Keyboard.print ("h"); }
  
  delay(100);
}

long microsecondsToInches2(long microseconds2)
{

  return microseconds2 / 74 / 2;
}

long microsecondsToCentimeters2(long microseconds2)
{
  
  return microseconds2 / 29 / 2;
}

but in this scenario only get a reading from pin 2 ?

You don't need a separate function for each value:

[code]
.
.
.
  inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);
.
.
.
}

long microsecondsToInches(long microseconds) {
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
  return microseconds / 29 / 2;
}

[/code]

unsigned long pingRange (byte pingPin)
{
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  return pulseIn(pingPin, HIGH);
}

Saves typing and debugging.

ok I fixed the mistake you pointed out john. ( I didn't make the changes you suggested AWOL simply because I don't understand them and feel I would end up wasting time trying to figure it out , thanks though)

I tried it on both sets of code that I posted and now each are.

const int pingPin1 = 2;
const int pingPin2 = 7;

void setup() {
  
  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
  long duration2, inches2, cm2;

  pinMode(pingPin1, OUTPUT);
   pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin1, LOW);
   digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin1, LOW);
   digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  pinMode(pingPin2, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
   duration2 = pulseIn(pingPin2, HIGH);

  inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);
  
  Serial.print(inches1);
   Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();
  
  
  
  delay(100);
}

long microsecondsToInches(long microseconds) {




  return microseconds / 74 / 2;

}

long microsecondsToCentimeters(long microseconds)

{
  
  return microseconds / 29 / 2;

this one gives me nonsense readings on pin 2 , don't know why that is , could it be the delay 5 milli seconds instead of 2 , just spotted that.

const int pingPin1 = 7;
const int pingPin2 = 2;
void setup() {

  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
  long duration2, inches2, cm2;

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(2);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

  inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);


}

long microsecondsToInches(long microseconds1) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){


{


  return microseconds / 29 / 2;
  
}

this one now says "microseconds is not declared in this scope. thanks for the help guys , do you know what i'm doing wrong.?

long microsecondsToInches(long microseconds1) {
return microseconds / 74 / 2;
}

Read again, carefully.

NB your code as written now will not work. You're starting pings on both devices and listening for the return from the first, but then you're expecting to read the result from the second, but it's likely to be over by then.

ok I've slightly lost you , I removed the errant 1 so my code is now

const int pingPin1 = 7;
const int pingPin2 = 2;
void setup() {

  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
  long duration2, inches2, cm2;

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(2);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

  inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);


}

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){


{


  return microseconds / 29 / 2;
  
}

are you saying I need to read my code more carefully or johns advice ?

You need to read my NB - you send two pings almost simultaneously, then listen for the echo from the first.
When you’ve finished timing it, you then wait for the echo from the other sensor, which in all likelihood has been missed.

When I said shorter and easier to debug, I meant it.
(Compiled, untested)

const byte pingPin1 = 7;
const byte pingPin2 = 2;

void setup() 
{
  Serial.begin(9600);
}

void loop()
{
  unsigned long  duration1 = pingRange (pingPin1);
  unsigned long  duration2 = pingRange (pingPin2);
  long inches1 = microsecondsToInches(duration1);
  long inches2 = microsecondsToInches(duration2);
  long cm1 = microsecondsToCentimeters(duration1);
  long cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);
}

long microsecondsToInches(long microseconds) 
{
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

unsigned long pingRange (byte pingPin)
{
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  return pulseIn(pingPin, HIGH);
}

Even shorter, though equally untested

const byte pingPin [2] = {7, 2};
const byte N_PINGS = sizeof (pingPin) / sizeof (pingPin[0]);
void setup() 
{
  Serial.begin(9600);
}

void loop()
{
  for (byte i = 0; i < N_PINGS; i++) {
    unsigned long  duration = pingRange (pingPin [i]);
    long inches = microsecondsToInches(duration);
    long cm = microsecondsToCentimeters(duration);

    Serial.print(inches);
    Serial.print("in, ");
    Serial.print(cm);
    Serial.println(" cm");
  }
  delay(100);
}

long microsecondsToInches(long microseconds) 
{
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

unsigned long pingRange (byte pingPin)
{
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  return pulseIn(pingPin, HIGH);
}

nota bene , I will get back to you when I have done so

thanks

Firstly thank you for the code the second one works exactly as I wanted it to , thank you. Secondly I will attempt to address your nb as to my code. From what you said I was starting both pings simultaneously but then reading one before the other. To my mind this is both pings being started simultaneously

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(2);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

I thought that this couldn’t be the problematic section as the processes being applied to both pins , including the delays were identicle. I also then looked at your working code and saw the sequence of processes were identicle apart from these sections.

pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);

pinMode(pingPin, INPUT);
  return pulseIn(pingPin, HIGH);

where you declared both pins as input and then high as opposed to declaring one high and one input and repeating. I thought that as there were no delays in this section this sequencing wouldn’t be a problem as both were carried out near instantly but I tired it anyway with no luck.

I thought the same of this section

inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);


}

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)


{


  return microseconds / 29 / 2;
  
}

what I thought was that the microseconds to inches section reffered to both pins so I couldn’t see how I was trying to reading one pin befor the other. I also tried sequencing my code exactly like yours (don’t bother reading this code if its just really stupid but I’’ll post it anyway , the result was no readings from either pin.)

const int pingPin1 = 7;
const int pingPin2 = 2;
void setup() {

  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
  long duration2, inches2, cm2;

  inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(2);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);



}

long microsecondsToInches(long microseconds) {
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){


  {


    return microseconds / 29 / 2;

  }
}

I also changed

pinMode(pingPin1, OUTPUT);
  digitalWrite(pingPin1, LOW);
  pinMode(pingPin2, OUTPUT);
  digitalWrite(pingPin2, LOW);

to

pinMode(pingPin1, OUTPUT);
    pinMode(pingPin2, OUTPUT);
 digitalWrite(pingPin1, LOW);
 digitalWrite(pingPin2, LOW);

after this , I don’t know if this had always been the case but suspect it has , I found that the readings for pin 7 were not nonsense but just x10 the readings from pin 2 and only reading multiples of 10.

I then tried t grasp the logic of the code/look at the reference page allot and see if writing it out in English would help me spot what I was doing wrong.

const int pingPin1 = 7;
const int pingPin2 = 2;

so I globally declare both ping pins a place to store intergers that I presume are the readings they take.

long duration1, inches1, cm1;
  long duration2, inches2, cm2;

I then declare six other variables , I don’t know why long the difference I can see is that long can simply store more numbers?

  pinMode(pingPin1, OUTPUT);
    pinMode(pingPin2, OUTPUT);
 digitalWrite(pingPin1, LOW);
 digitalWrite(pingPin2, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
  digitalWrite(pingPin2, HIGH);
  delayMicroseconds(2);
  digitalWrite(pingPin1, LOW);
  digitalWrite(pingPin2, LOW);

  pinMode(pingPin1, INPUT);
   pinMode(pingPin2, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
duration2 = pulseIn(pingPin2, HIGH);

I don’t have a very good understanding of this section, I sink then source then sink both currents ? Im guessing that this sends the sound beam then the sensor writes the pins high when the sound beam returns. And duration is the value of time it takes for the pins to be written high.

inches1 = microsecondsToInches(duration1);
  inches2 = microsecondsToInches(duration2);
  cm1 = microsecondsToCentimeters(duration1);
  cm2 = microsecondsToCentimeters(duration2);

I then state that my inches and cenimeters are eaqul to an equal to a new set of variable

 Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();

  delay(100);

print the results with a delay.

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){


{


  return microseconds / 29 / 2;
  
}
}

then this section performs the mathematics which convert the durations into cm and inches.

I still don’t understand where the error is occurring , can you explain?. It would be more satisfying to understand why this code isn’t working rather than using your code. Plus I need to write some if statements and I don’t know how i'd create separate inch values in your code

Reading your nb again your saying that I’m reading the pulsein times at different times but in my limited capacity of code understanding I don’t see where the differentiation is happening ?. so essentially I am still a bit clueless , sorry.

To my mind this is both pings being started simultaneously

And so it does, both start their transmit pulses probably only a few microseconds apart.
(There’s a reason this may be A Bad Thing, but we’ll come back to that)
Problem it, sound is slow, so having kicked off the sound pulses on their round trips to the target, there’s nothing to do but sit and twiddle our thumbs waiting for the echo.
This thumb-twiddling is done here duration1 = pulseIn(pingPin1, HIGH); which sits and waits until an echo is received.
If you’re like me, you can only do one set of thumb-twiddling at once, but sound echoes, like time and tides, wait for no man.
So, your duration1 = pulseIn(pingPin1, HIGH); picks up the first echo (which is where the Bad Thing may occur) and “pulseIn” returns with a pulse length.
So you call “pulseIn” again for the other echo pin…see the problem?
The sensors don’t buffer the echo pulses, they report them in real-time.

The Bad Thing is that simple hobby sonars can’t distinguish if the echo they heard was from their own transmitted pulse, or someone else, so it is best to fire them alternately, with an adequate pause to allow echoes from more distant object to die away.
Remember, they’ll typically stop timing as soon as the first echo is received, so if you then immediately fire another ping and start listening, your may hear a distant echo from the first pulse, and mistake it for an echo from your most recent pulse.

ok I think I got you. I feel though I have been qiute remiss is failing to mention I only have one sensor (i’m waiting for the others to arrive) which I’m swapping between pin 13 and pin 2.

my new code is

const int pingPin1 = 7;
const int pingPin2 = 2;
void setup() {

  Serial.begin(9600);
}

void loop()
{

  long duration1, inches1, cm1;
 

  pinMode(pingPin1, OUTPUT);
   digitalWrite(pingPin1, LOW);
delayMicroseconds(2);
  digitalWrite(pingPin1, HIGH);
delayMicroseconds(2);
 digitalWrite(pingPin1, LOW);
 pinMode(pingPin1, INPUT);
  duration1 = pulseIn(pingPin1, HIGH);
  
  inches1 = microsecondsToInches(duration1);
    cm1 = microsecondsToCentimeters(duration1);
  
  delay (100);
  
  long duration2, inches2, cm2;
   pinMode(pingPin2, OUTPUT);
   digitalWrite(pingPin2, LOW);
delayMicroseconds(2);
  digitalWrite(pingPin2, HIGH);
delayMicroseconds(2);
 digitalWrite(pingPin2, LOW);
 pinMode(pingPin2, INPUT);
  duration2 = pulseIn(pingPin2, HIGH);


  
  inches2 = microsecondsToInches(duration2);
cm2 = microsecondsToCentimeters(duration2);

  Serial.print(inches1);
  Serial.print(inches2);
  Serial.print("in, ");
  Serial.print(cm1);
  Serial.print(cm2);
  Serial.print("cm");
  Serial.println();



}

long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds){


{


  return microseconds / 29 / 2;
  
}
}

I thought this would ressolve the issue as the firing of the pins and the reading of their pulse time happens one after the other. What I’m seeing on the serial monitor though is still the strangeness of pin 13 showing readings 10x what they should be (but actually functional in every other respect). does my new code address the problem I was trying to address?. also I’m a bit worried as my installation will be 5 sonar invisible pianos using the keyboard.press function to trigger notes on a soft synth and I’m thinking that with 5 sonars the overall delay once the pings have been kicked off and read in sequence might prevent real time playing?. I also thought that as the sonars are all facing in different directions I would be able to remove allot of the delays as the returning beam could not then be misinterpreted as only its sending sonar module would be there to receive it.also in the code you gave me (which works)

const byte pingPin [2] = {13, 2};
const byte N_PINGS = sizeof (pingPin) / sizeof (pingPin[0]);
void setup() 
{
  Serial.begin(9600);
}

void loop()
{
  for (byte i = 0; i < N_PINGS; i++) {
    unsigned long  duration = pingRange (pingPin [i]);
    long inches = microsecondsToInches(duration);
    long cm = microsecondsToCentimeters(duration);

    Serial.print(inches);
    Serial.print("in, ");
    Serial.print(cm);
    Serial.println(" cm");
  }
  delay(100);
}
long microsecondsToInches(long microseconds) 
{
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

unsigned long pingRange (byte pingPin)
{
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);
  pinMode(pingPin, INPUT);
  return pulseIn(pingPin, HIGH);
}

there seems to be no delay between the two pins?.could you tell me how to differentiate the inch values in this code then i could have it as a back up if I can’t get my code to work ?

thanks

If you’ve only got one sensor, how is you “pulseIn” working?

hmm well the way i thought it was working was that the sonar is wired to 5v ground and then 13 which it goes through the whole sink source pluse in process with and gives me a result. then I remove it from pin 13 and put it in pin 2 and see what the result is there. I should have said I'm only ever looking at one result at a time.