Hello @vrtx,
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/Frequency
Hardware considerations:
Consider something slower like the Wikipedia page animation that you can visualize.
Code that toggles every frame:
// 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;
}
:)