# Having trouble slowing my screen display

**URL:** https://discourse.processing.org/t/having-trouble-slowing-my-screen-display/25453
**Category:** Coding Questions
**Created:** [November 16, 2020, 12:38am UTC](https://discourse.processing.org/t/having-trouble-slowing-my-screen-display/25453 "2020-11-16T00:38:34Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 17, 2020, 11:25am UTC](https://discourse.processing.org/t/having-trouble-slowing-my-screen-display/25453/8 "2020-11-17T11:25:29Z")

</div>

Hello,

There are many ways to do a timer and I have tried them all at one time or another.

You can use millis(), frameCount, Time & Date functions (see reference), counter, Java timer class, etc.

Slowing down frameRate us useful for slowing things down and I often use it for debugging or as required.

The default frameRate for draw() (stated in the reference) can be used as is or set and is used for animation or as required.

It is important to understand the flow of setup() and draw() before integrating a “timer” in your code.

Some good stuff here:

[![](https://img.youtube.com/vi/o8dffrZ86gs/hqdefault.jpg "3.1: Flow (setup and draw) - Processing Tutorial") ](https://www.youtube.com/watch?v=o8dffrZ86gs)

Example timer with millis():

> [@Need assistance with timing! \[millis()\]](https://discourse.processing.org/t/need-assistance-with-timing-millis/18854/4):
>
> I provided a simple example: int whattimeisitnow; int whattimeisitatstartofstopwatch; int timepassedtoresetstopwatch = 1000; //setup runs once void setup() { whattimeisitatstartofstopwatch = millis(); } //draw loops 60 frames per sec void draw() { whattimeisitnow = millis(); if (whattimeisitnow \> whattimeisitatstartofstopwatch + timepassedtoresetstopwatch) { println("1000 ms have passed!"); whattimeisitatstartofstopwatch = millis(); //reset st…

You can add more println() statements to see value of variables as it progresses:

> **Timer \< Expand for code**
>
> ```auto
> int whattimeisitnow;
> int whattimeisitatstartofstopwatch;
> int timepassedtoresetstopwatch = 1000;
> 
> //setup runs once
> void setup()
> {
> whattimeisitatstartofstopwatch = millis();  
> println(whattimeisitatstartofstopwatch);
> }
> 
> //draw loops 60 frames per sec  
> void draw()
> {
> whattimeisitnow = millis();
> if (whattimeisitnow > whattimeisitatstartofstopwatch + timepassedtoresetstopwatch)  
> {
> println("1000 ms have passed! Time elapsed (ms): ", whattimeisitnow);
> whattimeisitatstartofstopwatch = millis(); //reset stopwatch and start over
> }
> }
> 
> ```

`:)`

---

_[View the full topic](https://discourse.processing.org/t/having-trouble-slowing-my-screen-display/25453)._
