[PD] Pduino: change read speed
Christian Klippel
ck at mamalala.net
Sat Jan 13 03:59:48 CET 2007
Am Samstag, 13. Januar 2007 03:31 schrieb Roman Haefeli:
> hello
[...snip...]
>
> would it be easy to change the code of the firmware, so that it sends
> the values of each analog input with a fixed rate (e.g. 100 Hz)?
>
> i am not a c programmer, anyway i tried to search for kind of a delay
> function in the code, but couldn't find anything. am i right in
> assuming, that as it is now, it cycles through the code and sends each
> time the values with the maximum possible rate, or in other words: there
> is no speedlimit in the firmware? if so, how hard would it be to
> implement kind of a speedlimit on the arduino-side?
>
> any suggestions are welcome.
>
the best way would be to implement a threshold and a gating function that
handles the adc readouts. i'm doing that in the multio. it works like this:
the last sent value is saved. the actual readout is compared to that, and if
the difference is above a given threshold, it will open the gate for a
certain amount of time. during that time it sends all values (as long as they
change, regardless of the threhold). each time the change is above the
threshold, the open-time is reset. now, when the changes are below the
threhold during the gate-open time, the time runs out. then it closes the
gate again and the whole thing starts over.
this has two advantages: when nothing happens, there are no values to send at
all. but while the gate is on, you dont miss any change, allowing for smooth
transistions, and get all values as they come in.
> roman
>
greets,
chris
>
>
>
>
>
> ___________________________________________________________
> Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail:
> http://mail.yahoo.de
>
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
More information about the Pd-list
mailing list