Go Down

Topic: float to int (Read 823 times) previous topic - next topic

Christopher Warnow

Hi,

Is there a way to put values returned from a sin() function into the delay()? Or in other words can one convert float into int?

Thank You

Christopher

mellis

To convert a float to an int, you need to cast it.  That is, something like this:

int i = (int) 5.3;

or:

delay((int) (sin(0.5) * 1000));

Christopher Warnow

Thank you very much. :)
Works like a charm.

Go Up