Ken Gracey
01-25-2009, 08:31 AM
Hey there,
I've set up a program in which I'd like the sensors to run in their own cog, continuously (pingAverager). The pingAverager object is attached. I'm not passing any parameters to that object when it starts, but I'd like global access to the variables created in the pingAverager·object (leftDistance, centerDistance, etc.).
This is my top program. When I run it, the cog launches the Start method in pingAverager but the next line of code doesn't begin (HB25.Start). If I comment out the new cog launch then the HB25 object works fine. I'm not receiving the COG result, either. What's keeping the HB25.Start object from executing?
Thanks,
Ken Gracey
'Propeller Robot
'Object Avoidance Using Three Ping))) Ultrasonic Sensors
'
CON
'Set clock speed to 80 MHz
· _clkmode = xtal1 + pll16x······· 'Sets the clock speed to 80 MHz using a times 16 multiplier
· _xinfreq = 5_000_000············ 'Crystal speed: 5 MHz
· stopLeft = 1500
· stopRight= 1500
· fastLeft = 1800
· fastRight= 1800
VAR
· long· Stack[50]
· long· rightDrive
· long· leftDrive
· long· count
··················
OBJ
· HB25···· : "HB25"
· Ser····· : "FullDuplexSerial"
· Distance : "PingAverager"··
PUB Main
· cognew(Distance.Start, @Stack)
· HB25.Start(13,1,1)············
· repeat count from 1500 to 1800
··· HB25.set_motor1(count)
··· HB25.set_motor2(count)
··· WaitCnt(300_000 + Cnt)
I've set up a program in which I'd like the sensors to run in their own cog, continuously (pingAverager). The pingAverager object is attached. I'm not passing any parameters to that object when it starts, but I'd like global access to the variables created in the pingAverager·object (leftDistance, centerDistance, etc.).
This is my top program. When I run it, the cog launches the Start method in pingAverager but the next line of code doesn't begin (HB25.Start). If I comment out the new cog launch then the HB25 object works fine. I'm not receiving the COG result, either. What's keeping the HB25.Start object from executing?
Thanks,
Ken Gracey
'Propeller Robot
'Object Avoidance Using Three Ping))) Ultrasonic Sensors
'
CON
'Set clock speed to 80 MHz
· _clkmode = xtal1 + pll16x······· 'Sets the clock speed to 80 MHz using a times 16 multiplier
· _xinfreq = 5_000_000············ 'Crystal speed: 5 MHz
· stopLeft = 1500
· stopRight= 1500
· fastLeft = 1800
· fastRight= 1800
VAR
· long· Stack[50]
· long· rightDrive
· long· leftDrive
· long· count
··················
OBJ
· HB25···· : "HB25"
· Ser····· : "FullDuplexSerial"
· Distance : "PingAverager"··
PUB Main
· cognew(Distance.Start, @Stack)
· HB25.Start(13,1,1)············
· repeat count from 1500 to 1800
··· HB25.set_motor1(count)
··· HB25.set_motor2(count)
··· WaitCnt(300_000 + Cnt)