Cannot get HC-SR04+ to work with Photon using New_Ping library. Same part works perfectly with Arduino using NewPing.
if you are using the arduino files,
maybe try using these,
The library port was never really finished
Either @kennethlimcp or some other Elite would need to find the time to actually dive into that to get it to work with Particle devices, but since one fundamental library (
SparkIntervalTimer) isn’t available for Gen3 devices (yet) I’m not sure when.
However, PRs are always welcome
My project uses a Photon. I don’t know how to use Arduino libraries in my Particle Photon Sketch. In setting up my project, I ONLY get the option to use New_Ping from Particle (which doesn’t work). Is there a way around this?
Thank you for responding.
Doesn’t sound too encouraging. Don’t know what a PR is…a Request?
PR stands for Pull Request. When you have some contribution for a GitHub repo you can submit that for the owner of the repo to pull into his code.
What function of New_Ping do you need?
Or could you use any of the other libraries provided for the HC_SR04?
You could even just use the
I just need the most basic distance measurement, sonar.ping_cm(). I need to learn how to access the other possible libraries. Will also look at pulseIn().
Thank you for the suggestions.
Great idea. Looks like pulseIn() would do the job. Thanks very much!
Final note: I followed your suggestion and used pulseIn() and it worked perfectly! Thanks again for your help.