The stupid mistake that this idiot cannot see.

The stupid mistake that this idiot cannot see. My nunchuck has values from 0-255. I need to control a motor. So, I use

(nchuk.joyY()-127)

To get (-127 to 127) But, I am trying a max speed of eight. So I use

8/127*(double)(nchuk.joyY()-127

So, why is

Speed = 8/127*(double)(nchuk.joyY()-127);

Speed always zero?

Because in integer division, 8/127 is zero. Move the division to the end of the expression.

Or use :

Speed = 8.0/127.0*(double)(nchuk.joyY()-127);