Help converting OBEX object to C
Greg LaPolla
Posts: 323
in Propeller 1
I am not really a C guy but I am attempting to convert a timer spin object to C. I am stuck on this line of code, spin2cpp cant even do it correctly as it wont run as converted by spin2cpp.
The spin code line is :
Any insight is much appreciated!
The spin code line is :
okay := cogon := (cog := cognew(updateTimerDown, @tmrStack)) > 0
Any insight is much appreciated!
Comments
dgately
cogs do not return a value and run continuously.
Mike
Here is the code
timer.cpp
timer_countdown.h
timer_countdown.cpp
timer_countdown.cpp:9:25: error: lvalue required as unary '&' operand
timer.start() does not return. It appears to lock up when called.
timer.c
timer_countdown.h
timer_countdown.c
Mike
Enjoy!
Mike
Change it to the following:
You can use print function in a cog because it violates the pin rule but you can set pins high and low to see where it is.
also the function pause(1000) can be used to delay 1 second.
Mike
One more thing your returning a point that is already a pointer...
Thanks