Object Call Syntax?
Humanoido
Posts: 5,770
I'm trying to make the top object call the second file as you can see in the code but having a problem with the correct syntax. How to put the object call into the coginit statements? Thanks in advance.
I think the problem is here in this top object file statement with BlinkLED.
I think the problem is here in this top object file statement with BlinkLED.
COGINIT (1,BlinkLED, @stack1) ' Start cog 1, load/run BlinkLED, reserve Stack, pin 0
Comments
That's exactly what this method does in the context of a new SPIN cog (5th posting in that thread).
Alternatively you could call a generic method on all objects and said method starts a new cog with a local method, e.g.
However, you'll have to figure out a way of specifying the cog ID to be used (e.g. by passing a parameter to the start method). Keep it simple!
as with the command coginit YOU as the coder have to specify a cog-id and
then take care ALL the time which cog is used and which not.
If you always use cognew the interpreter takes care of the cog-id
cognew it and forget it except for running out of cogs
best regards
Stefan
So why don't you provide us with a cognew based solution then? Preferably one which can cope with any eventuality (like more then one active cog at the time of the call, the OP doesn't explicitly exclude that case).