Up and running but have som small problems
port513
Posts: 50
Trying to launch 2 cogs at the same time but only one will execute the code.
PUB Main
· coginit(1, heart.Run(17), @stack)
· coginit(2, heart.Run(4), @stack2
If I run this only cog 1 will execute it's code and if i comment out coginit(1... it will execute the code in cog 2.
Why?
/Henrik
PUB Main
· coginit(1, heart.Run(17), @stack)
· coginit(2, heart.Run(4), @stack2
If I run this only cog 1 will execute it's code and if i comment out coginit(1... it will execute the code in cog 2.
Why?
/Henrik
Comments
In general it's best to use cognew instead of coginit. It make the code more portable and prevents mistakes of overwriting cogs unintentionally. There are few instances where there's a true need for coginit.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
This code still only execute one or the other cog, and I really don't understand why?
What I'm trying to do is to understand multiple cog use.
/Henke
It seems that I always need a method in my main program that execute the objects code to get this working,
I added this method
After that I can execute heart.run(pin) in any cog
Isn't this pretty weird? Do I really need to create a method to launch a method?
/Henke
/Henke
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
For the moment there is much play with my STDD to learn how everyting is done. I have a pretty weird project for my work there I must have 2 Propellers communicating over ETHERNET.
/Henke