PI in arduino

Is there a predefined constant for pi in arduino? Or do you have to define it yourself?

M_PI is it, IIRC

Doesn't M_PI require the math.h library?

from arduino.h

define PI 3.1415926535897932384626433832795

define HALF_PI 1.5707963267948966192313216916398

define TWO_PI 6.283185307179586476925286766559

define DEG_TO_RAD 0.017453292519943295769236907684886

define RAD_TO_DEG 57.295779513082320876798154814105

Doesn't M_PI require the math.h library?

What are you doing with ?, if not maths?

Cool thanks. Didn't know it had to be in caps.

Also, does anyone know if the delay() function can take in decimals above 1? Such as 1.5, 7.5, etc.... I know it behaves erratically if entered a value less than 1.

No, delay takes only integers. For shorter delays, use "delayMicroseconds", which again, takes only integers.

Also, does anyone know if the delay() function can take in decimals above 1? Such as 1.5, 7.5, etc....

Yes it will take floats but as AWOL pointed out, it will be converted (== truncated) to an integer type. That means delay(1.5) and delay(1) and delay(1.95) will take the same amount.

Using delayMicroseconds will solve this, but be aware that delayMicroseconds is not accurate below ~3 uS or for longer periods. I have seen that people split something like delay (30.5) in delay(30): followed by delayMicroseconds(500); which makes sense.

But better, dont use delay, as you don't need it -> check the blink without delay() example.