Topic
  • 1 reply
  • Latest Post - ‏2012-10-01T09:18:29Z by shanz9903
GuiccoPiano
GuiccoPiano
3 Posts

Pinned topic Basic Counter

‏2012-10-01T08:39:05Z |
Hi
I am implementing a very basic simple countdown counter which counts from 10 to 0 with counting down by one value after 1 second.
Now, I have a state machine in which I have a state CountDownState for counting down.
One way of counting down is enter this CountDownState again and again using tm(1000) trigger and everytime reduce the value by one. But I dont want to enter this state again and again.
I just want to enter it once and in the "Reactions in State" part, I wish to have a delay of 1 second and print the value till my value reaches 0.
Is there any delay function for this?
I wish to do something like this: In state CountDownState; in Reactions in State
while(myVal != 0)
{
cout<<myVal;
myVal--;
//HERE COMES THE COMMAND FOR 1 SECOND DELAY. ANY IDEA WHAT THE COMMAND IS??
}

Thanks.
Updated on 2012-10-01T09:18:29Z at 2012-10-01T09:18:29Z by shanz9903
  • shanz9903
    shanz9903
    283 Posts

    Re: Basic Counter

    ‏2012-10-01T09:18:29Z  
    OMDelay()