Answers.Body: <p>I don't think there is a shortcut.  The timer sensors record how much time has elapsed since they were reset.  The starting of the program gives you the first reset for free.  So the psuedocode ends up something like this.  The button touched vs released is a personal preference.  I think of the interval as starting when the button is released and extending until it is pressed.  </p>
  
  <ul>
  <li>Set a variable "totalTime" to zero</li>
  <li>Loop start</li>
  <li>wait for button touched</li>
  <li>Set a variable "intervalTime" = timer sensor value</li>
  <li>Set "totalTime" = "intervalTime" + "totalTime"</li>
  <li>Set intervalTime = 0</li>
  <li>wait for button to be released</li>
  <li>write to the LCD display "ready for next interval"</li>
  <li>wait for button to be touched</li>
  <li>wait for button to be released</li>
  <li>reset the timer sensor</li>
  <li>Loop end (forever)</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-05T20:09:41.947Z
Answers.LastActivityDate: 2018-02-05T20:09:41.947Z
Answers.UserDisplayName: dfrevert
Body: <p>We're trying to pause the timer block, and then have it restart at the same time where it left off.   </p>
  
  <p>By using the touch sensor in a loop before our timer code we were able to get the text output to stop and restart, however on restart the text output just jumps to the current timer output, so it's clear we're not actually pausing the timer output. </p>
  
  <p>Any ideas on how to pause and restart the timer block using the touch sensor?</p>
  
  <p>Here's our code:
  <a href="https://i.sstatic.net/r79NW.png" rel="noreferrer"><img src="https://i.sstatic.net/r79NW.png" alt="enter image description here"></a></p>
  
Tags: <ev3>
Title: How to pause, and restart (without resetting), a timer block - ev3
UserDisplayName: Agent Zebra
ThreadText: # How to pause, and restart (without resetting), a timer block - ev3
  
  (Asked by: username_0 on 2018-02-04)
  
  We're trying to pause the timer block, and then have it restart at the same time where it left off.
  
  By using the touch sensor in a loop before our timer code we were able to get the text output to stop and restart, however on restart the text output just jumps to the current timer output, so it's clear we're not actually pausing the timer output.
  
  Any ideas on how to pause and restart the timer block using the touch sensor?
  
  Here's our code:
  [![enter image description here](https://i.sstatic.net/r79NW.png)](https://i.sstatic.net/r79NW.png)
  
  **Tags:** ev3
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-05. Score: 4 | Accepted answer
  
  I don't think there is a shortcut. The timer sensors record how much time has elapsed since they were reset. The starting of the program gives you the first reset for free. So the psuedocode ends up something like this. The button touched vs released is a personal preference. I think of the interval as starting when the button is released and extending until it is pressed.
  
  * Set a variable "totalTime" to zero
  * Loop start
  * wait for button touched
  * Set a variable "intervalTime" = timer sensor value
  * Set "totalTime" = "intervalTime" + "totalTime"
  * Set intervalTime = 0
  * wait for button to be released
  * write to the LCD display "ready for next interval"
  * wait for button to be touched
  * wait for button to be released
  * reset the timer sensor
  * Loop end (forever)
  
  
  ---
  
  