Yun, Node, Firmata and PulseIn

Hi,

Im tryingo to implement a simple example with Yun, node and a proximity sensor hc-sr04 as reported here https://github.com/rwaldron/johnny-five/wiki/Ping .
So far Im not able to get it working, becasue I guess the standard firmata shipped with the Arduino Ide does not implement PULSE_IN function.
I tried to go with some replacement, f.i. Modified firmata protocol that works on the arduino YUN linux side communicating to the arduino side using the ttyATH0 serialport interface. With Pulse_In support · GitHub or https://github.com/rwaldron/johnny-five/wiki/Ping, but still no success.

I checked with a simple sketch (https://gist.githubusercontent.com/flakas/3294829/raw/4bdca307fd4bdb35f95c6b682c318ca61c04e250/hc-sr04.ino) the hardware and it works fine.

I guess there is still something not working properly with my firmata firmware.
Any suggestion?

Thank you in advance.
Marco

Ok. Fixed.

The problem was with the Firmata firmware.
I added a small delay as follows

pinMode(argv[0],INPUT);
delayMicroseconds(1);
duration = pulseIn(argv[0], argv[1],timeout);

and all now works properly.
M@rco