Ultrasonic Ranger problems

22 Nov 2009

In the months I've been away from mbed, the flimsy knowledge of "C" that I had seems to have evaporated.  The examples in the SRF05 cookbook entry are not making sense to me.  I've grafted the second example onto the first and tidied it up but the compiler tells me that Class mbed::DigitalIn has no member "rise" which is true but I don't see what that has to do with "echo.rise(&rising)" which is the statement it is objecting to. This applies to the next line too but with "fall" instead of "rise".  Is this something you were going to implement, Chris, and it's not there yet or have I lost yet another thread in the time off?

Pip

22 Nov 2009

I think you just need to use InterruptIn and not DigitalIn on echo

23 Nov 2009 . Edited: 23 Nov 2009

Hi,

I think echo is an object of the type DigitalIn:

DigitalIn echo(pN); // Somewhere in your code

In library version 13 the rise function is moved from the DigitalIn class to the InterruptIn class. Change the snippet above to:

InterruptIn echo(pN);

And it should work.

By the way, another very differen change is that all the pins are not anymore named by a number, you have to add a p in frond of the number, like for pin 10 it's p10 now.

 

Cheers

Rolf

24 Nov 2009

Having spent some time and energy trying to fathom the cookbook entry for the ultrasonic ranger (SRF05), I found the Hello World example lurking in the header file in the SVN (which works a treat).  It would have helped if the Hello World was in the cookbook section or at least a pointer to the header for that info. On the upside, I have a slightly better idea of what is going on!

Pip

24 Nov 2009

Hi Pip,

The cookbook should be editable by you (look at the bottom of the page for an edit button), so it'd be great if you could update it to include this.

You now probably have the most up to date experience out of everyone, plus we'll be a bottleneck if we have to do everyone edits/ideas.

Simon