In function 'void loop()': error: invalid convers

Hey everyone I keep getting this error:

In function ‘void loop()’:
error: invalid conversion from ‘int (*)()’ to ‘long unsigned int’ In function ‘int calcDelay()’:

I’m wanting to use the value returned from a function as the value for delay(); The code in the loop is a series of servoWrite. values and delays that are generated from an animation.

any insights as to what I’m doing wrong would be appreciated

Nick

#include <Servo.h>

Servo myServo1;

int servoPin1 = 50;
int inputPin1 = 0;

int minPulse = 500;
int maxPulse = 2700;

int convVal;
int inValue;
int inmin = 0 ;
int inmax = 1024;

int outmin = 1000;
int outmax = 10;

void setup(){
myServo1.attach(servoPin1,minPulse,maxPulse);

}

void loop()
{
myServo1.write(0);delay(calcDelay);
myServo1.write(6);delay(calcDelay);
myServo1.write(12);delay(calcDelay);
myServo1.write(19);delay(calcDelay);
myServo1.write(26);delay(calcDelay);
myServo1.write(34);delay(calcDelay);
myServo1.write(42);delay(calcDelay);
myServo1.write(49);delay(calcDelay);
myServo1.write(57);delay(calcDelay);
myServo1.write(65);delay(calcDelay);
myServo1.write(73);delay(calcDelay);
myServo1.write(81);delay(calcDelay);
myServo1.write(89);delay(calcDelay);
myServo1.write(97);delay(calcDelay);

///… and more values like this
}
int calcDelay()
{
inValue = analogRead(inputPin);
convVal = map(inValue,inmin,inmax,outmin,outmax);

return convVal;
}

You need to call calcDelay(), not just dereference it.

Learning about arrays and for loops may reduce your code size too.

Thanks for the quick reply - I knew it had to be something simple I wasn't seeing.