Show Posts
Pages: 1 2 [3] 4 5 ... 35
31  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 21, 2014, 10:43:32 am
Quote
Now to remove notifications of replies to this thread...
The equivalent of putting your hands over your ears and saying "nana nana" I am not listing any more. Mainly because as fas as I see it you have no real technical arguments to back up what you are saying.

Quote
Because it's too hard for you and Mr. grumpy troll to write faster code that makes me wrong?
It is not hard to write port direct manipulation code it is quite trivial actually and I use it when it is needed. However, it it does have its disadvantages mainly it is not portable across other arduino platforms and it has a certain obfuscation factor for a beginner.
I wonder how you can call me a Trol as I was the one that sorted out the OPs problem in the first place and that it was indeed that he was using too little delay not too much.

 
Quote
I have a lot of experience developing video game controllers.
Then you should know better that to think that 2uS or 0.0625uS makes any difference to the feel of anything. You can't even perceive the difference between 2uS and 200uS lag. In the context of a video game anything less than the frame rate of the video is fine, which you will know if you were a real games designer.

Tell you what:- make a game where two LEDs come on 200uS apart, then you have to press a button indicating what LED came on first. If the result is anything significantly greater than the chance 50% results I will concede you have a point, which you don't.

Quote
Sorry, but reducing lag is the #1 goal of a video game controller,
Your assertions remind me of the gold plated mains connector Hi-Fi brigade. Full of assurance but with no substantial technical claims to back it up. Once the lag has been reduced to imperceptible proportions the prospect of halving that lag holds no great appeal to anyone who is actually interested in the game.

Quote
But, digitalWrite() and delay() will work too, just not as well, accurate, and with more lag.
There you go again, making a statement with no justification, no reasons, and what is more totally wrong.

In any games controller the signals have to be slow enough for the controller to recognise them, make them too fast and they will not all get picked up, which is precisely what the OP was having trouble with.

Seems you're worked into quite a froth.  Even though I've developed video game controller hardware for 20 years and was featured in Popular Science on the subject, I conceded to your prowess and desire to argue over nothing and I'll take the adult route here.

Tim
32  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 21, 2014, 09:54:49 am
I am doing an installation that works with two sr04, and I am quite satisfied with the results I am achieving so far.

and I just wanted to turn on a pair of relays based on the sensors activity, and so far i got it to work almost the way i want, the sensors will work almost in parallel (slightly different angles to give'em more viewing angle).  I found the cast operator to be more friendly to deal with the cm array, but I am not sure if its the proper way of doing it.

as of the relays, i want them to turn on when there's somebody in the range of the sensors, otherwise it must be turned off, any advice or suggestion will be much apreciated, and what I got so far is, they turn on on presence, but turn off only when somebody is 10 cm or closer, but not when out of range, i tried to stop and turn the ping on again as suggested on page 19, but I'm not achieving the results I seek

and Teckel, excelent job, and thanks a bunch for your activity in this thread, as an arduino lover and a maker, I am obliged to thank people like you!

I'm not sure why you're creating the floating variable "f" and why you're then dividing the distance by two.  That will just add a lot of overhead to your code.  But, a distance of "0" means out of range.  So, if you want to turn something on when in rage and off when out of range your code would look something like this (I cleaned it up a bit too):

Code:
#include <NewPing.h>

#define SONAR_NUM      2
#define MAX_DISTANCE 350
#define PING_INTERVAL 33

#define RELE1 7
#define RELE2 8

unsigned long pingTimer[SONAR_NUM];
uint8_t currentSensor = 0;

NewPing sonar[SONAR_NUM] = {
  NewPing(13, 12, MAX_DISTANCE),
  NewPing(4, 2, MAX_DISTANCE)
};

void setup() {
    Serial.begin(115200);

    pinMode (RELE1, OUTPUT);
    pinMode (RELE2, OUTPUT);
    pingTimer[0] = millis() + 75;
    for (uint8_t i = 1; i < SONAR_NUM; i++)
      pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;
}

void loop() {
  for (uint8_t i = 0; i < SONAR_NUM; i++) {
    if (millis() >= pingTimer[i]) {
      pingTimer[i] += PING_INTERVAL * SONAR_NUM;
      sonar[currentSensor].timer_stop();
      currentSensor = i;
      sonar[currentSensor].ping_timer(echoCheck);
    }
  }
  // Other code that *DOESN'T* analyze ping results can go here.
}

void echoCheck() {
  if (sonar[currentSensor].check_timer())
    pingResult(currentSensor, sonar[currentSensor].ping_result / US_ROUNDTRIP_CM);
}

void pingResult(uint8_t sensor, int cm){
  if ( cm == 0 ) {
    digitalWrite (RELE1, LOW);
    digitalWrite (RELE2, LOW);
  } else {
    digitalWrite (RELE1, HIGH);
    digitalWrite (RELE2, HIGH);
  }

  Serial.println(cm);
}

The problem with this code however is that you have two sensors.  One may detect an object and the other may not.  So, it could turn on and off so quickly you can't even tell.  You probably need to use the original multi-sensor sketch that stores the results in the array and then process the results where you can make logic decisions based upon results of maybe one sensor detecting an object and the other not, or distances that are wildly different.

Basically, while my above sketch will work the way you asked, it won't really work the way you want.  Going back to the original sketch and storing the results in the array and then using different logic is probably what you really want.

Tim
33  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 21, 2014, 08:54:26 am
I agree the topic is a little heated right now, however teckel brings some good point to the table.

Regardless of the accuracy required in one step the CPU would have additional cycles to spend elsewhere from a saving gained in another task which has been optimized and is running in the same time slice.

If you do not need those precious cycles, that extra time can be used to sleep, ultimately preserving battery life.

However, 2 hz is incredibly slow when I think back to the button mashing days of Tekken and such.

Thanks, I have a lot of experience developing video game controllers.  Heck, I was featured in Popular Science for developing arcade game hardware.

The ATmega8 is well-adapted to providing a low-lag and low-power solution at a low cost with easy programming and a good support community (usually).  A very fine controller can be made with the ATmega8 at the core.  But, only if fast and power-efficient code is written.  Sure, other sloppy or easy ways will work, and it will "work" using digitalWrite() and delay().  But, I would highly suggest an event-driven programming paradigm instead of block.

Interrupt and timer based programming paradigms can work great for a project like this.  But, digitalWrite() and delay() will work too, just not as well, not as accurate, and with more lag.

Tim
34  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 21, 2014, 08:11:33 am
Look we are talking about human interaction here, you are talking about the difference between an instruction being executed within 4uS or 0.0625uS, in the context of a human reaction these two are identical.
Yep. You'd have to be Superman to continuously press and release a button any faster than about 2Hz (500mS), so what does a few uS matter? For most of the posters here, digitalWrite is easier to understand and sufficient for their needs.  Although I've written in Assembly (admittedly, 25 years ago) I haven't got my head around port manipulation yet, mainly through lack of need.

Reducing lag is the #1 goal of a video game controller, and 2Hz is SLOW!  Are you really saying that you can't hit a button more than twice a second?  Honestly, you've never played a video game, have you smiley-wink

For this project, using the ATmega8 microcontroller, port manipulation is the best way.  You can suggest that maybe it isn't required, but it's not wrong to suggest a faster method.

Tim
35  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 21, 2014, 08:04:10 am
Quote
Back to the subject of this thread instead of your troll-like derailment of the subject.
It only looks like that because you are totally wrong.
You have not mentioned one little bit of why you think it needs to be synchronised to anything.

Quote
To reduce lag, I ....
Look we are talking about human interaction here, you are talking about the difference between an instruction being executed within 4uS or 0.0625uS, in the context of a human reaction these two are identical.

Quote
So, for accuracy sake, I don't use digitalWrite, ever.
Fine, I wonder why you bother with a processor that only runs at 16MHz, all that wasted time and total inaccuracy.

Quote
port registers will generate more accurate results than digitalWrite, and that's a fact.
It is a fact and it is a pity that you can not see it is a totally irrelevant fact.

Quote
I don't typically use Arduino hardware, I use a bare ATmega8.
Looks like you are in the wrong place to give advice then.

So I'm right, it's faster, more accurate and will have less lag.  But *in your opinion* lag isn't important to video game controllers?  There's a few hundred million people that would disagree with you that lag isn't important in video games.

Tim
36  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 20, 2014, 02:46:03 pm
Quote
I'm thinking accuracy, not speed.
He is simulating a person pressing a button repeatedly, there is nothing to be accurate about. The pressings are not synchronised to anything, that is there is no point of reference. So what exactly do you mean by accurate?

digitalWrite is slow, therefore, when you tell it to execute there's a delay before it happens.  So, for accuracy sake, I don't use digitalWrite, ever.  If you do, fine, keep doing it, more power to you.  I would just not suggest doing it at all, ever.  Or at least, install the digitalWriteFast library and use those functions instead.  I don't typically use Arduino hardware, I use a bare ATmega8.  I also create circuits/sketches where speed, program size, power, and serviceability are important.  So I may have different priorities than others.

Back to the subject of this thread instead of your troll-like derailment of the subject... My guess is the project in this thread is some kind of game controller that creates rapid button presses based upon a button being pressed.  To reduce lag, I would therefore avoid using digitalWrite, as if you want to more accurately make a pin go high every set number of milliseconds, port registers will generate more accurate results than digitalWrite, and that's a fact.

Tim
37  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 20, 2014, 01:02:18 pm
Quote
I would also suggest using port register calls instead of digitalWrite.
What! That would make the pulses even faster, so even more would be missed.

I'm thinking accuracy, not speed.  The wait time between pulses may need to be adjusted if you used port register calls instead of digitalWrite.  But, the wait time would be more accurate as well.  You're right, in that he's probably just trying to do too many pulses too quickly.  Slow the time down between pulses but don't use digitalWrite.

Maybe I just have a thing against digitalWrite.  I *NEVER* use it for the ATmega8 processors.  I also never use delay(), so maybe this entire thread rubbed me the wrong way.

Tim
38  Using Arduino / Programming Questions / Re: Delay and digitalWrite Inconsistency on: May 20, 2014, 12:10:13 pm
I actually ended up finding someone who had made pretty much this exact project, i'll post the link just for anyone else who wants to look at it. I'm hoping to find the solution to my problems in these notes.

http://forums.shoryuken.com/discussion/15876/the-programmable-stick-pad-thread/p4

That's some "special" programming there.  Getting back to the original code, I would also suggest using port register calls instead of digitalWrite.  If you're trying to make the timing as exact as possible, not using delays and using port registers are the way to go.

Tim
39  Using Arduino / Programming Questions / Re: Something is wrong on: May 20, 2014, 12:02:58 pm
What's wrong is the uber-ambiguous title to this thread.

Tim
40  Using Arduino / Programming Questions / Re: Problem implementing ultrasonic interrupt (new ping library) on: May 20, 2014, 12:00:37 pm
Thats great Tim, thanks for the pointers and email reply. A real help for possible direction to start looking.

I hope I can get this reviewed and improved soon.

The camera uses SPI, which is uses pins 10-13.  You're also trying to connect the ultrasonic sensor to pins 11 and 12.  So, you have two things wired to the same pins, which of course will cause a problem.  Always know what pins a shield uses and always try different pins if you ever have a problem.  Even if a shield isn't connected to a pin, it could use a timer that's tied to a pin which could cause a conflict.

Tim
41  Using Arduino / Programming Questions / Re: Problem implementing ultrasonic interrupt (new ping library) on: May 20, 2014, 09:09:47 am
I've had some help with the coding of an ongoing project (see previous my previous posts if you want background) which is now working, since I have tried to develop it to include an ultrasonic (SRF05) but cannot even get it to serial.print distances.
I am trying to use the new ping library and think it could be conflicting with some of the other libraries / code.
There are some other posts on here which discuss using event-driven interrupts within this library but I could not get a clear answer from it.

I have tried accessing the ultrasonic data at different baud rates, to no avail. However, with the same setup (connections) and a simple script the ultrasonic works fine.

Simply put, I am trying to have the ultrasonic cause my robot to stop and reverse when it finds an object in front of it before continuing with the program (object removed).   

Code:
#include <Wire.h>
#include <NewPing.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
#include <SPI.h> 
#include <Pixy.h>

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

    #define swap(a,b) { \
        int c = (a);    \
        (a) = (b);      \
        (b) = c;        \
    }
   
Pixy pixy;
 
Adafruit_MotorShield AFMS = Adafruit_MotorShield();                 
Adafruit_DCMotor *MotorL = AFMS.getMotor(1);
Adafruit_DCMotor *MotorR = AFMS.getMotor(2);


void setup()
{
  Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
   
  AFMS.begin();  // create with the default frequency 1.6KHz
  MotorL->setSpeed(255); // Set the speed to start, from 0 (off) to 255 (max speed)
  MotorL->run(FORWARD);// turn on motor
  MotorL->run(BACKWARD);
  MotorL->run(RELEASE);
 
  MotorR->setSpeed(255); // Set the speed to start, from 0 (off) to 255 (max speed)
  MotorR->run(FORWARD);// turn on motor
  MotorR->run(BACKWARD);
  MotorR->run(RELEASE);
}

void loop()
{
  uint16_t blockCount;
  blockCount = pixy.getBlocks();
  Serial.print(" Blocks : ");
  Serial.print(blockCount);
  Serial.print(" ");
 
  const double minRequiredRatio = 0.8;
  const double maxRequiredRatio = 1.2;
 
  int chosenBlock = -1;
  int chosenSignature = 1;
   
  for (int idx = 0; idx < blockCount; ++idx)
  {
    Block& pixyBlock = pixy.blocks[idx];
   
    if (pixyBlock.signature != chosenSignature)
    {
      continue;
    }
   
    int objectSize = pixyBlock.width * pixyBlock.height;
    double objectRatio = (double)pixyBlock.width / (double)pixyBlock.height;
    Serial.print("Size : ");
    Serial.print(objectSize);
    Serial.print(", ");
    Serial.print("Ratio : ");
    Serial.print(objectRatio);
    Serial.print(" ");
 
  const double squareTolerance = 0.5; // Adjust to suit
    double squareness = fabs(1.0 - objectRatio);
   
    const double minRatio = 0.8; // Adjust to suit
    const double maxRatio = 2.0; // Adjust to suit

    if (objectRatio > minRatio && objectRatio < maxRatio)
     {
      chosenBlock = idx;
      break;
    }
  }
 
  if (chosenBlock < 0)
  {
      Serial.println("Could not find desired object");
      MotorL->run(RELEASE);
      MotorR->run(RELEASE);
     return;
  }

Block& singlePixyBlock = pixy.blocks[chosenBlock];

 int objectX = singlePixyBlock.x;
  int objectY = singlePixyBlock.y;
 
  Serial.print(", X Value : ");
  Serial.print(objectX);
  Serial.print(", Y Value : ");
  Serial.println(objectY);
 
    const int cameraWidth = 320;
  const int cameraHeight = 200;
  const int centreX = cameraWidth / 2;
  const int centreY = cameraHeight / 2;
 
   const int idealDistanceSize = 5000; // Adjust to suit
  const int idealDistanceTolerance = idealDistanceSize / 10; // Adjust to suit
 
  int objectSize = singlePixyBlock.width * singlePixyBlock.height;
 
  const int maxSpeed = 255;
  const int slowestSpeed = maxSpeed - 128; // Adjust to suit
  const int distLimit = 10; //Limit for obstacles (in cm)
  int dist = sonar.ping_cm();
 
  int centreOffset = objectX - centreX;
  int speedOffset = ((double)centreOffset / (double)centreX) * (double)(maxSpeed - slowestSpeed);
 
  int speedLeft = slowestSpeed - speedOffset;
  int speedRight = slowestSpeed + speedOffset; 

 int motorDirection = RELEASE;
  Serial.print("objectSize: ");
  Serial.print(objectSize);
 
  if (dist<distLimit)
  {
    motorDirection = BACKWARD;
    Serial.print("Ping: ");
    Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
    Serial.println("cm ");
  }
 
  if (objectSize < (idealDistanceSize - idealDistanceTolerance))
  {
    motorDirection = FORWARD;
    Serial.print(" FORWARD ");
  }
  else if (objectSize > (idealDistanceSize + idealDistanceTolerance))
  {
    swap(speedLeft, speedRight);
    motorDirection = BACKWARD;
    Serial.print(" BACKWARD ");
  }
  else
  {
    Serial.print(" RELEASE ");
  }


  MotorL->setSpeed(speedLeft);
  Serial.print(" MotorL: ");
  Serial.print(speedLeft);
 

  MotorR->setSpeed(speedRight);
  Serial.print(" MotorR: ");
  Serial.print(speedRight);
 
  MotorL->run(motorDirection);
  MotorR->run(motorDirection);
 
}

I would agree with everyone else here.  There's a LOT you could do better with that code.  I sent you an email reply that fixes most of your sketch.  But, I'd like to post here that it sounds like there's a conflict with a timer.  One of the pins you're using with the ultrasonic sensor could be used as a timer for the motor or camera sensor.  So, try using two pins that don't have a timer attached, like pins 7 & 8.

That's where I would start, clean up your code so it's more understandable and logical, then try using different pins.  Next, adopt an event-driven paradigm instead of the block mode programming style you're currently using.  Doesn't work well for robots.

Tim
42  Using Arduino / Sensors / Re: Auto gain control AGC amplifier for 40 kHz ultrasonic transducer on: May 15, 2014, 01:06:57 pm
Hi, I'm using a 40 kHz ultrasonic transducer to measure the distance of an object, and I need an AGC amplifier IC for my ultrasonic receiver. However I couldn't find any one.

does any one know such an IC device ? The name of the company and the part number of the IC would be also really helpful for me.

Thanks alot

Not to say that you can't make an amplifier to work with the transducer to measure distance.  But, it's a fairly complex and expensive task.  Instead, there's very inexpensive (like $2) sensors that already include the transducers and amplifier so you don't need to re-create anything.  Doing it on your own will be more expensive and probably not as good as a $2 already made sensor.

Tim
43  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 15, 2014, 01:00:50 pm
I used newping libray but It error compiling...

sketch_may15a.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files\Arduino/sketch_may15a.ino:10: undefined reference to `NewPing::NewPing(unsigned char, unsigned char, int)'
C:\Program Files\Arduino/sketch_may15a.ino:10: undefined reference to `NewPing::NewPing(unsigned char, unsigned char, int)'
C:\Program Files\Arduino/sketch_may15a.ino:10: undefined reference to `NewPing::NewPing(unsigned char, unsigned char, int)'
sketch_may15a.cpp.o: In function `loop':
C:\Program Files\Arduino/sketch_may15a.ino:18: undefined reference to `NewPing::ping_cm()'

Please hlep me!

Sounds like you didn't install the library correctly.  Did you decompress it (keeping the directory structure in tact) and put it in your arduino's libraries folder?  I believe there's now also an option in Arduino 1.0.5 to import a library.

Also, you should really always provide your sketch (or mention if you're using an example sketch).  But, these errors are basically saying that it can't find the library AT ALL.  So, you didn't install it correctly (or you just need to close Arduino and open it again).  If you do this and verify the library is installed correctly in your libraries folder like the rest of your libraries and you still have a problem, please indicate the sketch you're using or paste the sketch to your reply.

Tim
44  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 12, 2014, 03:23:46 pm


How many pins are you using?  4?  One pin for triggers on all sensors and 3 pins to get the results from each sensor?  If so, you could just use 3 pins by using the method I describe.

Tim

Please forgive me Tim, I am not understanding, I am using four pins as you have stated but I don't understand how to wire the sensor to only use three pins. This surely would be better because I can add a forth sensor pointing to the rear.

Here is the setup code I am presently using.

Code:
#define LED_STATUS_PIN 13
#define SONAR_NUM     3 // Number or sensors.
#define MAX_DISTANCE 300 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 66 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).
...
unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.
byte currentSensor = 0;          // Keeps track of which sensor is active.

NewPing sonar[SONAR_NUM] = {     // Sensor object array.
NewPing(7, 10, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
NewPing(7, 11, MAX_DISTANCE),
NewPing(7,  5, MAX_DISTANCE),
...
for (uint8_t i = 0; i < SONAR_NUM; i++) {       // Loop through all the sensors.
    if (millis() >= pingTimer[i]) {               // Is it this sensor's time to ping?
      pingTimer[i] += PING_INTERVAL * SONAR_NUM;  // Set next time this sensor will be pinged.
      if (i == 0 && currentSensor == SONAR_NUM - 1)
      {
          oneSensorCycle();
          serialCom();
      }          // Sensor ping cycle complete, do something with the results.
      sonar[currentSensor].timer_stop();          // Make sure previous timer is canceled before starting a new ping (insurance).
      currentSensor = i;                          // Sensor being accessed.
      cm[currentSensor] = 999;                      // Make distance zero in case there's no ping echo for this sensor.
      sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
    }
  }


NewPing supports the ability to use one pin per sensor.  You simply wire a single pin to the trigger and the echo pins on the sensor.  That's it!  In your sketch, you would set the trigger and echo pin as the same pin.  The magic all happens in the library.  It would look something like this:

Code:
NewPing sonar[SONAR_NUM] = {     // Sensor object array.
NewPing(10, 10, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
NewPing(11, 11, MAX_DISTANCE),
NewPing(5,  5, MAX_DISTANCE),
NewPing(7,  7, MAX_DISTANCE)
};

This would ping each device independently, and not all at once like you're doing now.  The way you're doing it could cause bad echo problems.

Tim
45  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: May 12, 2014, 11:56:36 am

I've never tried using the same trigger pin for multiple sensors nor is the library designed to work this way.  What NewPing would do would be to actually try to initiate a ping three times each sensor.  The sensor would probably ignore this, but there's no guarantee.  Also, I would be concerned with the higher likelihood of echos giving bad results or the pulsing from multiple sensors confusing the sensors.

It would be better (avoiding echos and cross-talk issues) and use fewer pins to just wire a single pin to each sensor's trigger and echo pin.  In other words, you would use 3 pins, each pin going to each sensor's trigger and echo pins.  This would use 3 pins instead of (I assume) the 4 pins you're currently using.  Yes, you would need to ping each sensor individually, but using the non-blocking ping_timer() method your microcontroller could be doing other things while the ping sound is traveling.  I would consider this a more "sound" way to implement 3 sensors.

May I ask, why do you want to ping all three at the same time?  Would it really matter if each ping was 30ms apart?  You could still ping 3 sensors 10 times a second while still "multi-tasking" and doing other processes in your sketch.  Insight on your project and the reasoning would be helpful.

Tim

Thank you for the very quick response Tim,

The primary reason is the limitation of available pins on the Pro-Mini. I have each sensor angled outside of each others echo zone. so there is little or no interferences that I can detect at this point. I may have to upgrade to a Arduino mega before this project is finish.

How many pins are you using?  4?  One pin for triggers on all sensors and 3 pins to get the results from each sensor?  If so, you could just use 3 pins by using the method I describe.

Tim
Pages: 1 2 [3] 4 5 ... 35