Why can i not have a decimal delay time?

Hi, I am using an Arduino Uno with a simple circuit, where pin 9 is connected to a buzzer and then to the ground. I have the following script to make it sound:

const float c = 0.26163;

void setup() {

void loop() {

void play(double pitch) {

If i play with pitch as 1.5ms, it makes the exact same pitch as 1ms, can someone explain why, and how i would fix this?


delay() only accepts an integer parameter. Read the documentation.

okay, is there perhaps a way i can deal with smaller units?
Also, why did it not error, and just round down instead?

delayMicroseconds() may help ;p

The float was converted to an integer type. The decimal is effectively chopped off.

You could probably achieve something like what you're trying to do with delayMicroseconds(). But you have to do some math.

thanks, this will work.

By the way, there are no scripts in C++. Only source code. Also, decimal only means base 10. Not trailing decimals.