Let's Make Robots!

SimpleIDE HCSR04 Library for Propeller

https://github.com/Maxhirez/libHCSR04

Since there are so many of us adding Propeller to the arsenal these days, I decided to try my hand at building a library.  Parallax is of course famous for their $30, 3-pin ultrasonic unit which other than pinout looks exactly like the cheaper HCSR04 modules that most of us have floating around.  This was just an experiment to port the code from Arduino to Prop C and it works just like you'd expect.  There are three functions, HCSRping, HCSR_cm and HCSR_inches, and each takes two arguments-trigger and echo pins, in that order.

I haven't tested this with multiple sensors but I don't imagine it will cause any problems.  There are no pauses (except in the demo where it pauses a half second between reads in the terminal.)  It probably wouldn't matter much with the cog assignment system though.

Comment viewing options

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

I think I am going to go with spin.... ( I change my mind hourly on this.... a womens prerogitive)  ;-)

I'll give this a try tonight.