Why doesn't this function work?


I have this function to generate pwm values for my leds.

int zonneschema(int opkomst, int ondergang , int maxwaarde, int uur, int minuut, int secon)
  float uren = uur;
  float minuten = minuut/60;
  float seconden= secon/3600;
  float totaal = uren+minuten+seconden;
  float a;
  float midden = (ondergang+opkomst)/2;
  int ledwaarde;
  a= maxwaarde/((midden-opkomst)*(midden-ondergang));
  ledwaarde=round( a*((totaal-opkomst)*(totaal-ondergang))); 
  if(ledwaarde> 0)
   return ledwaarde;
 else {return 0;}

I use it like this:

int  gr_out = zonneschema(7, 22, 70, RTC.hour, RTC.minute, RTC.second);

But I only start to get values if it is later than 8 hour?
Normally it would start giving me values higher than 0 from 7 hour?

  float minuten = minuut/60;

Unless the value in minuut is larger than 60, the result will always be 0. Dividing by 60.0 would give different results.

Thanks , now it works