division of variables results in zero, despite values in variables divided
i have issues. serial monitor displays values used division carrying number values,, yet result 0 regardless of changing value of variables used. using arrangement
int angularvelocity = jv / jt ;
am missing something?? here paste of few lines around it.
int jv = map (joyvelocity, 0, 1023, -255, 255);
int jt = map (joyturnangle, 0, 1023, -32000, 32000);
serial.print (jt);
serial.print (" ");
serial.println (jv);
int angularvelocity = jv / jt;
serial.println (angularvelocity);
int velocityright = angularvelocity * (jt + 5);
int velocityleft = angularvelocity * (jt - 5);
int angularvelocity = jv / jt ;
am missing something?? here paste of few lines around it.
int jv = map (joyvelocity, 0, 1023, -255, 255);
int jt = map (joyturnangle, 0, 1023, -32000, 32000);
serial.print (jt);
serial.print (" ");
serial.println (jv);
int angularvelocity = jv / jt;
serial.println (angularvelocity);
int velocityright = angularvelocity * (jt + 5);
int velocityleft = angularvelocity * (jt - 5);
well jt,being of time way larger jv, , both being integers, division (using int) of à small number larger 1 0.
Arduino Forum > Using Arduino > Programming Questions > division of variables results in zero, despite values in variables divided
arduino
Comments
Post a Comment