SparkFun Forums 

Where electronics enthusiasts find answers.

User avatar
By rsalasidis
I tried the following program
Code: Select all
void setup() {
  // put your setup code here, to run once:

  Serial.println("Test Ser Out");

  String test = String(5.02131234, 4);


void loop() {
  // put your main code here, to run repeatedly:
I get the following output
Code: Select all
Test Ser Out
Any ideas
User avatar
By rsalasidis
Thanks, I see that after posting.

However, I do need to fix it, are there any precompiled mbed os files that can be used in place of the default one, or is there a detailed explanation how to resolve this using a windows (not linux) system.

I would rather avoid having to use a custom ftoa subroutine to do this.

Unfortunately as well, the project is very time limited, and this needs to be resolved over the next 24-48h.

By paulvha
There has not been an updated pre-compiled boards library.

You can use the same steps as I posted there on 7 april.

Unzip and make the 2 changes in HardwareSerial.cpp in the directory location: <userdir>\AppData\Local\Arduino15\packages\Sparkfun\hardware\apollo3\2.2.1\cores\arduino\mbed-bridge\core-implement
User avatar
By rsalasidis
I did that, but it did not work. The program compiled ok, but the floats still only print the format string, and not the actual number.

I was not sure if that was for the padded strings, or if enables the standard printf.

I also tried adding an mbed_app.json file in my root, but I don't think that would work without an mbed recompile.

Let me know if the changes listed should work for enabling all std printd features, and maybe I did something wrong?
By paulvha
you are right. The approach in the post is only changing/correcting a "serial.printf()", not a sprintf(). need to take a bit more time to look into that.
User avatar
By rsalasidis
I used an ftoa function off the net for now (while hopefully a variant mbed OS is compiled with the full printf enabled). However, your suggestion would have made a good temporary replacement as well.

 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum