Please help me with cog control on my project!!!
Tony_tsi
Posts: 98
This will be a easy fix for some one but I just cant figure it out. I am making a variable time/variable intensity light controller. I have notes in the code to tell where I need the cogs to be. lines 355-375 is where I need help.
Comments
To stop a cog, use Any cogs you plan on stopping, make sure to get that variable when you start it. If you don't, you can use cogid to get the current cog the function is running in.
Are you calling functions from an object started in another cog? For example, if you start the PWM object with Cog 0, then you cannot call functions from the PWM object from Cog 1. You can get around this by starting the other cog (in this example, the PWM object) in the cog you need the functions.
I made a long var called stack
I made some changes to the code.
the timer cog works it is launched in line 360.
the pwm cog does not work it is launched in line 359.
they use the same command how come one works and the other doesn't?
I have tried every thing I know and everything I could find in my book. I give up for tonight.
.
Doing this can freeze up your cog or even the whole chip. If this is not the problem, I don't know what is. The cognew commands should work fine.
so if I made pwm_on and pwm_off bytes instead of longs it might work
May I ask what you did to get it to work?
I don't know what code you are looking at, but I can't see it in the one he just uploaded, nor the old one.....
Forever???
I think it was fixed when I put dira[5]~~ in the pub pwm_c but i am not entirely sure. do you have to list your dira in each cog.
So instead of telling it to go to main i should tell it to end??
so what if i replace if ina [1] == 0 main with if ina [1] == 0 exit
Just seen your post about quit and return.