View unanswered posts | View active topics It is currently Mon Sep 01, 2014 2:47 pm






Reply to topic  [ 2 posts ] 
Timers & values 
Author Message
Rookie

Joined: Thu Jul 07, 2011 12:49 am
Posts: 3
Post Timers & values
hi.
Is there a way to display the timer value? I'd like to be able to run the timer, and stop it at some time, keep that value and show it. i don't know how to do this. Putzing for a while isn't getting me anywhere.
We are trying to use the timer as a sort of stopwatch.
Any help out there?
Thanks.
plulai


Fri Jan 25, 2013 5:17 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Timers & values
What do you mean "show it"? You can make a simple stopwatch like this:
Code:
task main(){
  while(button is not pressed){  //wait for button to be pressed.
    Wait1MSec(1);
  }

  ClearTimer(T1); //set timer to zero

  while(button is not pressed){  //wait for button to be pressed again
    Wait1MSec(1);
  }
 
  int time = time1[T1]; //time = the number of milliseconds that have passed.
}
 

_________________
sudo rm -rf /


Fri Jan 25, 2013 5:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.