right you should be able to use
libpd_float("ultra1", distance);
The best place the line is immediately after
distance = duration / gRescale;
so you only send the value when you have a new measuerement.
Then, if your Pd patch has the following:
[loadbang]
|
[metro 100]
|
| [receive ultra1]
| |
[f ]
|
[print distance: ]
this should print it on the console (note that I am not using simply
[receive ultra1]
|
[print distance: ]
as that would print too many messages, flooding your console, so I am printing every so often with [metro]
. But if you are using the message directly, you don't need the [metro]
part above.)