hi
this bugging me little, trying enter decimal number program via serial port.
if enter, 0.5 read 0.5 if enter .5 read 5.0.
i assume being dumb here , should using different input code.
any suggestions welcome providing legal , not offensive , kept sensible getting grips coding , lot of read goes on head att.
regards... colin
this bugging me little, trying enter decimal number program via serial port.
if enter, 0.5 read 0.5 if enter .5 read 5.0.
i assume being dumb here , should using different input code.
code: [select]
float stepsize=0.0; // step size
serial.print ("enter step size mm [x.x]");
while (serial.available() <= 0) {}
stepsize = serial.parsefloat();
serial.print(" ...");
serial.print(stepsize, 2);
serial.println(" mm");
any suggestions welcome providing legal , not offensive , kept sensible getting grips coding , lot of read goes on head att.
regards... colin
quote
i assume being dumb here , should using different input code.no, , yes.there appears bug in parsefloat(), shouldn't using anyway.
Arduino Forum > Using Arduino > Programming Questions > 0.5 is read as 0.5 but .5 is read as 5.0 - why
arduino
Comments
Post a Comment