Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Timed Triggers and modulos

$
0
0

@JDeut wrote:

I’m working on a bit of code to make something happen every couple of seconds.
The idea was something like this:

if (ofGetElapsedTimef() % 8) {
printf(“ok, it’s working”);
}

But this throws an error about floats - maybe having something to do with floating-point resolution in C++. So, I end up trying:

if (fmod(ofGetElapsedTimef(), 8)){
printf(“ok, it’s working”);
}

And this does not work like expected.

Any thoughts on how to do this and why this approach isn’t working?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles