Shop OBEX P1 Docs P2 Docs Learn Events
Added HC-SR04 ping sensor to C library — Parallax Forums

Added HC-SR04 ping sensor to C library

GeeksGoneBadGeeksGoneBad Posts: 100
edited 2013-07-12 08:34 in Propeller 1
Hey everybody - I was playing around with my cheap HC-SR04 Ping sensor and the new SimpleIDE - anyway I noticed that the library only supported the Ping with the trigger and echo on the same pin and the HC-SR04 has the echo and trigger on different pins...

anyway I modified the Ping library and added support for the HC-SR04 sensor - who should I send it to? :)

Jamie

Comments

  • FernandFernand Posts: 83
    edited 2013-07-09 21:44
    Great! I have several of these.
    Is there a standard place such things can get posted?
    Is there some place I can download it from?
  • JLockeJLocke Posts: 354
    edited 2013-07-09 22:35
    Have you tried uploading it to the OBEX?

    Oops, sorry; didn't notice that this wasn't SPIN code.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 23:07
    Since it is for the SimpleIDE and not SPIN I would say upload it here or possibly in he PropGCC section until Parallax has somewhere to upload Library files to. I could also use this.
  • GeeksGoneBadGeeksGoneBad Posts: 100
    edited 2013-07-10 03:59
    OK Here's what I got :) I'll look for the GCC section too

    so basically I added the functions

    ping_hcsr04(echopin, triggerpin)
    ping_cm_hcsr04(echopin, triggerpin)
    ping_inches_hcsr04(echopin, triggerpin)

    you can replace your libping library in the Learn\SimpleLibraries\Sensor folder as I did not alter the original functions so those should still work as before

    hope that helps a few people!

    libping.zip
  • Jeff MartinJeff Martin Posts: 758
    edited 2013-07-12 08:34
    JLocke wrote: »
    Have you tried uploading it to the OBEX?

    Oops, sorry; didn't notice that this wasn't SPIN code.


    C code is allowed on the Obex as long as there's no license conflict. Use the C language indicator when submitting; we want to encourage PropGCC C code to use that label.
Sign In or Register to comment.