passing variable between 2 objects, 2 cogs

I'm trying to learn how to pass variables from an object in a second cog back to an object in the original cog. The parent object (z_temp) displays a measurement from the child object(z_scratch). There is an example in the manual i have tried to copy, but the example seems to be 2 methods from the same object. I've tried declaring the variable in the DAT section as x long 0 I found in a thread that solved someones else's similar problem. I've tried other things as well and not sure how to proceed. Also the code gets stuck in the child object after the cognew call (from the parent object) unless there is a RETURN dis at the end of the repeat loop(in the child object), nothing after the cognew will print in the serial terminal without this, and with the RETURN dis nothing correct prints either.

Another possible improvement is using a counter in positive detect mode for your pulse measurement. Clear the phsx register, wait for the pin to go high, then back low, then capture the pulse width in the phsx register -- this eliminates some of the math and instruction overhead.

will not work as expected, and worse will actually try to do something completely different. There's a discussion in the Propeller Manual under COGNEW, titled "Spin Code Can Only be Launched by its Containing Object".

Does a child object somehow inherit the clock setting from a parent object? From the library it looks like a lot of drivers don't declare clockmode. I changed dis:=distance to long[dis]:=distance...i still have a problem getting any numbers to display. I'll try again tonight. Thanks Jon and for the extra info, good to know.