I was wondering if anyone has had success with porting NewPing library on a Particle device? I am looking to interface to a DYP-ME007Y Ultrasonic Sensor.
I have had good success using the NewPing library with the DYP-ME007Y with the Arduino family of boards. I am familiar with the HC-SR04 library for Particle devices, however I would like to use DYP-ME007Y sensor because the ultrasonic transmitter/receiver element is waterproof and can mounted away from the board.
What exact feature do you want to see ported?
This lib does have several conditional compile instructions that would allow to build for Particle already (with minor include updates).
On first glance that’s the biggest change I could see required in NewPing.h
#if defined (PARTICLE)
#include "Particle.h"
#elif defined (ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif
and where you find #if defined (__arm__) && defined (TEENSYDUINO) you could go with #if defined (__arm__) && (defined (TEENSYDUINO) || defined (PARTICLE))
I am basically just looking to port the library to so it works with the DYP-ME007Y sensor. I will implement the changes you suggested above this evening and report back my results.
So I implemented the changes your outlined and the NewPing library with the DYP-ME007Y sensor works great. I will continue to tinker with it to check the performance and try the multiple sensor performance.