Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To read float number from stdin, add "-u scanf_float" option to the linker. This option is setup using a pseudomodule as it is already done for printf_float. Just add to your Makefile: USEMODULE += scanf_float Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
- Loading branch information
Showing
2 changed files
with
7 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,gdoffe
Thank you first for the efforts solving this problem . And I tried to use the Riot-master version that you merged this "float problem" into, and i use it now. I do find that you changed the Make.include part and the pseudomodules.inc.mk which is added the float part. And i then tried the suggestion that adding USEMODULE += scanf_float in Makefile. It is built and flashed successfully, but when i run it. I still cannot see any float number. You can see the picture below.
And i want to show you my code for this part.
you can see that i defined the variable speed float type and try to print it ,but it still cannot work. Could you pls help me find the reason why?
Thanks so much!
Best regard!
By Peiwen
7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use float values with printf, you also need to add the
printf_float
module to your application.7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I said add
USEMODULE += printf_float
to your application the same you did withscanf_float
module. There are already plenty applications doing this in RIOT codebase (trygit grep printf_float). But in a word, use
USEMODULE += scanf_float printf_floatand you'll be able to use
printfand
scanf` with floating point values.One last thing: as already pointed out by @kaspar030, don't comment in closed PRs for a usage question but rather send an email to devel@riot-os.org or users@riot-os.org mailnig lists.
7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7fc3207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.