[PD] sr04 with arduino standardfirmata?
Alexandros
adrcki at gmail.com
Tue Feb 6 09:18:26 CET 2018
The SR04 works by sending a trigger signal and waiting for the echo
signal. It then calculates the time between the two signals and
translates this to distance. All this happens in the pulseIn() function
used with this sensor.
In order to make it work with Firmata you must send a signal out the
trigger pin and as soon as you receive a signal from the echo pin you
must do the math to make the conversion, meaning, you must translate the
workings of pulseIn() to a Pd patch. Connecting a pin of the sensor to
an analog pin simply doesn't make sense.
You can instead use the code that is provided (don't know where, but
there are some examples for this sensor, right?), and on the Pd side use
[serial_print], an abstraction that works with Arduino's Serial.print()
function. You can get it here https://github.com/alexdrymonitis/Arduino_Pd
Make sure you read both the help patch and the Arduino sketch in order
to make the appropriate changes to your code.
On 06/02/2018 06:16 πμ, ray Y wrote:
>
> is there a work around for this?
>
> the sr-04 is a way cooler sensor than the ones supported by
>
> standardfirmata!
>
>
> why is it not supported?
>
>
> there most be a hack to make the emiter and receiver
>
> functions act as one with the signal going into the analog
>
> inputs of the arduino. as a standard sensor?
>
>
> wow, i google and there is almost nothing out there about this
>
> i'm a bit tired of trying to do this
>
>
> please help
>
>
> thanks
>
> r.y
>
>
>
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180206/6f7a41b9/attachment-0001.html>
More information about the Pd-list
mailing list