 Problem with Code: Arduino unable to multiply...

Hi Guys!
I have a problem with my code!
I usa a function H to get a specific Value (“tmpG”) at a specific time.that works fine! But than i want to scale it by mutliplying it with (32/FT) (“FT” is a predefined Value).
Now my problem: Without the scaling I recieve the tmpG value, but when i scale it a always get 0!

Heres the code:

int tmpG = 0;
int stoptime = 100;
int H(int x, int a) {
if (x < (0+a)) {
return 0;
}
return 1;
}
int x = 0;
void setup() {
Serial.begin(9600);
int x = 0;
}

void loop() {
int ST = stoptime;
x++;
if(x>=(6*(ST+FT))) {x=0;}
tmpG = (32/FT)*((x-ST)*H(x,ST));
Serial.print("\n x ");
Serial.println(x);
Serial.print(" tmpG ");
Serial.println(tmpG);
}

thanks for helping!

((float)32/FT)

When you divide an integer on something greater than the integer, you will always get 0 when dealing with integers. That's because the decimals get truncated.

Always cast the dividend to a type that handles decimals, in most cases float.

thanks!