Function Call Help!!!!

Hi everyone, I really need your help. Okay here's what I'm trying to do , I 'm trying to make use of the PWM pin on the arduino uno to release a output voltage so I can do something with it.
so here's my code so far :

int PWMTDS(float x )
{
  float result = x * 0.255;
  Serial.println(x);
  Serial.println(result);
  return result;

}

inside the void loop is like this

   float value = PWMTDS(TDS); 
   Serial.print(" PWM Value for reference:'");
   Serial.print(value);
   Serial.println("'");
   
   analogWrite(ledPin, value);
   delay(30);

in my serial monitor I'm able to see this :

2.86
0.73
PWM Value for reference:'0.00'
2.90
0.74
PWM Value for reference:'0.00'
2.90
0.74
PWM Value for reference:'0.00'
2.92
0.75
PWM Value for reference:'0.00'

I'm safe to assume that my function call is written correctly but how come there's no value at the value for the pwm?

int PWMTDS(float x )

The int says that the function should return an integer. Change to float.

Thanks HackScribble , I appreciate it a lot now it's working now !!!

One last thing , so if I write as per shown it will come out 0.72V on pin 9 is that right?

luckystar94:
One last thing , so if I write as per shown it will come out 0.72V on pin 9 is that right?

No, it'll come out as a PWM waveform, assuming "ledpin" has the value 9. (we can't tell because you didn't post your code).