How can I show the value of a float on the OLED display?

How can I show the value of a float on the OLED display?

If I use to_string(), what I get is nothing (black) instead of a number. Here’s a minimal example:

int main(void)
    // briefly display module name
    float n = 3.567;
    std::string str  = "Test: "+std::to_string(n);
    char*       cstr = &str[0];
    patch.display.WriteString(cstr, Font_7x10, true);

The actual output is:


The expected output is:

Test: 3.567

If I use an int, it shows the int OK.

I tried to use ostringstream, but that didn’t work either, then I started getting “out of memory” errors until I removed #include . Showing a float would be very useful for debugging.

You might find something helpful here:

Thank you,

I have looked at the documentation, and started working with the USB debugger.

One concern I have though is I don’t think some of the Patch hardware works correctly unless it is connected to the +/- 12 volt Eurorack power supply. So for example, I have added the:

LDFLAGS += -u _printf_float

flag to the make file and I am able to see floats on the serial monitor:

float Volume = VolumeKnob.Process();
hw.PrintLine("My Float: %f", Volume);

But the values are very wonky. ie they are always 1.0, unless the knob is all the way to the right, then it shows:

My Float: 0.999954

I’m wondering if this is related to insufficient power when powering over only the USB cable?

I recall from the ornament & crime documentation that you should not power the O&C from the Eurorack power supply and from USB at the same time unless you cut a trace on the Teensy:

cutting the trace is mainly a precautionary measure — it is to prevent people (you) from powering the teensy dev-board simultaneously from USB and the eurorack PSU when updating the firmware (or when “debugging” code via serial USB); doing so might have undesirable consequences. see the T3.2 schematic for details. cutting the trace is not essential for the module to work. if you prefer, you can leave the trace intact as long as you remember to disconnect your module from the eurorack PSU when connecting a/the USB cable. in this case, the teensy will be (= must be) powered solely from V_USB (= 5V) via the USB-cable, which will be just as fine for the purpose of occasionally flashing the MCU.

Soure: ornament & crime

Unfortunately, they don’t say what exactly the “undesirable consequences” are of doing this.

Is there a danger to connecting the Daisy via USB while the Patch has Eurorack power applied at the same time? Do I need a special cable or device that lifts the USB power?

I should also ask, is there any risk of damaging the Patch hardware by having the Daisy installed and powered over USB without Eurorack power? ie. under voltage to the OLED or something else?


Have you asked Electro-Smith support the questions about power?

I’m pretty sure it’s safe to have the Eurorack power, USB power, and the STLINK on all at the same time; I know I’ve used my Patch.Init() that way. I doubt there’s any risk using USB power without Eurorack power, but as you’ve noticed, there are things on the Patch which are only powered by Eurorack. This can be seen in the schematics.

But Electro-Smith should make all this clear somewhere.

There is no risk in damaging your Daisy by powering via USB and Eurorack simultaneously.

We will get this added in the technical documentation.

Thank you. The other concern is the possibility of damage to the computer/USB port. If the Daisy can be (partly) powered via the USB cable, wouldn’t that mean that current from the Eurorack power supply could also flow back towards the computer’s motherboard? Or is there something like a diode that prevents that?

There is a diode on the Daisy which prevents that so there is no risk of damage to your computer.

1 Like