# Millis . How to calculate 80hz in millis%

**URL:** <https://discourse.processing.org/t/millis-how-to-calculate-80hz-in-millis/39774>\
**Category:** Libraries\
**Tags:** homework\
**Created:** [November 18, 2022, 10:10am UTC](https://discourse.processing.org/t/millis-how-to-calculate-80hz-in-millis/39774 "2022-11-18T10:10:15Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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 18, 2022, 8:02pm UTC](https://discourse.processing.org/t/millis-how-to-calculate-80hz-in-millis/39774/5 "2022-11-18T20:02:52Z")

</div>

Hello @vrtx,

> [@vrtx](#):
>
> What i want is to make the rect flashes 80hz or 80 x per second.

Is a _flash_ an ON and OFF cycle? What is the duty cycle you want?  
You must give that consideration…

References:  
[https://en.wikipedia.org/wiki/Hertz](https://en.wikipedia.org/wiki/Hertz)  
[https://en.wikipedia.org/wiki/Frequency](https://en.wikipedia.org/wiki/Frequency)

Hardware considerations:

> [@How to make FrameRate faster](https://discourse.processing.org/t/how-to-make-framerate-faster/35790):
>
> Hello is there way to get more than 60fps

Consider something slower like the Wikipedia page animation that you can visualize.

Code that toggles every frame:

```auto
// Flashes (ON/OFF) at a frequency of 30 Hz with default frameRate of 60;

boolean toggle = false;

void setup() 
  {
  size(500, 500);
  fill(0);
  
  int fps = 60;
  int freq = fps/2; // Toggling each frame
  
  println("fps:", fps);
  println ("freq:", freq, "Hz"); 
  
  frameRate(fps); // The default is 60 fps
  }

void draw() 
  {
  if (toggle)
    background(255, 0, 0);
  else
    background(255, 255, 0);
  
  toggle = !toggle;
  }

```

`:)`

---

_[View the full topic](https://discourse.processing.org/t/millis-how-to-calculate-80hz-in-millis/39774)._
