How do i launch a object in the new cog? check out this code
grasshopper
Posts: 438
Whats wrong with the code it wont launch the lcd.init
Now if i do this it works
My problem is that I dont want to keep running lcd.init when I update the
"Pub Dispaly (Info,Mode,Time)" from my main code.
this line will continue to be updated form another object
{ Update Example } con slow = 60_000_000 'Led flashing speed slow fast = 2_000_000 'Led flashing speed fast On = 1 Off = 0 LEDPIN = 20 'Led Pin Var Long Stack[noparse][[/noparse]32] obj lcd :"LCDdriver" fs : "floatString" PUB start (Info,Mode,Time) : success dira[noparse][[/noparse]pin]~~ lcd.init lcd.cls Success := Cognew(Display(Info,Mode,Time),@stack) Pub Dispaly (Info,Mode,Time) Fs. SetPrecision(4) If (Mode == 0) lcd.pos(1,1) lcd.writestr(@screen) lcd.writestr(fs.Floattostring(Info)) lcd.pos(2,1) lcd.writestr(@screen1) waitcnt(Time + cnt) lcd.cls If (Mode == 10) lcd.cls lcd.pos(1,1) lcd.writestr(@Flashscreen1) lcd.pos(2,1) lcd.writestr(@flashscreen2) pause_it(5,factor1) waitcnt(Time + cnt) lcd.cls DAT screen1 byte "Top of",eos screen2 byte "Value = ",eos Flashscreen1 BYTE "Software",eos Flashscreen2 Byte "Version 3.2",eos
Now if i do this it works
Pub Dispaly (Info,Mode,Time) dira[noparse][[/noparse] pin ]~~ lcd.init lcd.cls Fs. SetPrecision(4) If (Mode == 0) lcd.pos(1,1) lcd.writestr(@screen) lcd.writestr(fs.Floattostring(Info)) lcd.pos(2,1) lcd.writestr(@screen1) waitcnt(Time + cnt) lcd.cls If (Mode == 10) lcd.cls lcd.pos(1,1) lcd.writestr(@Flashscreen1) lcd.pos(2,1) lcd.writestr(@flashscreen2) pause_it(5,factor1) waitcnt(Time + cnt) lcd.cls
My problem is that I dont want to keep running lcd.init when I update the
"Pub Dispaly (Info,Mode,Time)" from my main code.
Pub Dispaly (Info,Mode,Time)
this line will continue to be updated form another object
Comments
there is a difference in the methodnames
the PUB-definition is named "Dispaly"
in your cognew statement it is named "Display"
looks like a mistyping
you did not post your complete code as an attachment
so there are some questions left:
where is constant "pin" defined ?
could it be that there is a method display that still exists but you made all the changes inside Dispaly ??
Your code-snippet has a method PUB start (Info,Mode,Time) : success
Is this the TOPLEVEL object ?
Then the parameters are not initialized in the code-snippet.
the code that is posted in the first post: is this the COMPLETE code ?
I don't think so. Could you please post ALL files as an attachment.
This means: your mainfile AND LCDDriver.spin AND floatstring.spin AND whatever else is depending on those files?
best regards
Stefan