-->
Page 1 of 1

Cannot Print/create Float numbers...

PostPosted: Tue Oct 13, 2015 2:59 pm
by Diyhouse
OK,.. I am clearly doing something wrong,.. as all the docs say "it should work"... but what ever examples I try from various sources,.. fail in one way or another.

    a = 22/7
    print(string.format("%.2f", a))

What have I miss-understood... how do I set a number to be a float,.. the docs infer I just use it with decimal places.... Am I just trying to print float number incorrectly?...

Tx Guys

Re: Cannot Print/create Float numbers...

PostPosted: Tue Oct 13, 2015 3:27 pm
by xtal
NodeMCU FW 0.9.6 20150704 has a integer build and a float build, I suspect you may be using integer build.

Re: Cannot Print/create Float numbers...

PostPosted: Fri Oct 16, 2015 4:04 am
by Diyhouse
Yes that's the little gotcha I fell for... Many thanks for pointing that out...

For those interested,.. I download the two latest integer and float versions from:-

https://github.com/nodemcu/nodemcu-firmware/releases

And once downloaded use the nodeMCU flasher and under the config tab select the downloaded binary to be flashed.