Need some help figuring out this mess... trying to transfer a message
Don M
Posts: 1,652
Lets say I have a Main cog running something like this:
And the statement "object_in_own_cog.start" starts an object in it's own cog like this:
I'm trying to pass messages from the child object running their own cog whenever something happens so that the Main program will just "pick up" the message and print it when it happens.
I can get the child object to run ok on it's own but I never get any messages passed.
I know I'm missing something here trying to understand how this works or if it's even possible. Or if there is a better way of doing something this this.
Thanks.
Don
var byte message[128] pub term.start(31, 30, %0000, 115_200) object_in_own_cog.start(@message) repeat if message[0] <> 0 repeat idx from 0 to 128 term.tx(message[idx]) term.tx(13) bytefill(message, 0, 128)
And the statement "object_in_own_cog.start" starts an object in it's own cog like this:
PUB Start(MasterMessage) :okay stop subobject1.start subobject2.start okay := cog := cognew(method(MasterMessage) ,@Stack)+1 pub method(MasterMessage) if something_happens bytemove(MasterMessage, @mess, 34) dat mess byte "Message to display in Main program" ' 34 chanracters
I'm trying to pass messages from the child object running their own cog whenever something happens so that the Main program will just "pick up" the message and print it when it happens.
I can get the child object to run ok on it's own but I never get any messages passed.
I know I'm missing something here trying to understand how this works or if it's even possible. Or if there is a better way of doing something this this.
Thanks.
Don
Comments