The NEED for SPEED !

WOOOHOOO !   IT IS WORKY !!! ... or mostly so - some fine tuning is still required...

But holy cow lets compare ....

236 micro seconds vs 18,392 micro seconds ..

Ya a bit of a difference...   

Here are some pros and cons of the new PulseIn


  • WAY FASTER (nearly 2 orders of magnitude)
  • Probably DOES NOT INTERFERE WITH SERVOS !!! - a big one for me


  • Possibly a little less accurate - although I have not noticed .. additionally a little pre-filtering can be done easily

Another nice accessory from this project was the load timings.. now the Arduino load becomes easily observable ..  this takes a considerable amount of mystery out of trouble-shooting

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
beetlejuice's picture

Congrat, it's a lot faster

Congrat, it's a lot faster !

I've a question : with the non blocking script, how to take the current value ?

By exemple can we use someting like this ? : if ( sr04.value() <= 30) .....

I didn't found UltraSonic service in the javadoc .

GroG's picture

Hi Bettlejuice .. Ya -

Hi Bettlejuice ..

Ya - Javadocs are out often out of sync.
Please refere to this post for strategies on getting meaningful information -
My latest developments have not yet been "checked-in"..

But the interface should be similar to this :

(blocking mode)

 if (sr04.range() <= 30)

(non-blocking event mode)


def range(dist):
    if (dist <= 30)


The blocking mode is pretty trivial to implement - the non-blocking event mode would be very good for robotics ! (hopefully I can figure out how to do this)

beetlejuice's picture

Thank you

Thank you yes