result = potValue / 4 ;
result = potValue >> 2 ;
result := map (potValue, 0, 1023, 0, 255) ;
I'm trying to do something simple - convert analogue pin input (0 - 1023) to byte equivalent (0 - 255).
130*255/1023. Think about how that sum works.130 * 255 = 33150That's outside the amount that an int will store.
Is this behaviour (intermediate calcs being influenced by data type of variable) just Arduino, or is it C? Damn sure this has never happened to me in years of Java..?
int foo = 20;int bar = 35;float baz = 0.0;baz = foo / bar;