is there a direct way to send floating point (eg. 1.23) numbers to a display using u8g2lib.h?
Up to now, I split the variable into integer and decimal part by using modulo operation and so on but I've got the feeling, that there must be a better solution. Unfortunately google & co was not helpful until now...
most examples use "serial.print" but I want to send to display.
Is there some kind of "display.print" command?
Would appreciate if someone has a template that offers to set the number decimals
e.g.
float A = 1.234;
int d = 2;
"display.print(A,d)"
due to I'm still at the beginning getting into C++ and therefore asking for a template, the last answer linking to "serial.print" isn't a help at all. anyway, thanks for your response!
Could someone please post an example how to solve the task as described in the first post?
Sometimes i am really impressed by the replys. And I really wonder whether it is worth to answer questions here? Ok, forget all my answers. The only answer to your initial question is this link:
Maybe some other reader can answer the initial question. I probably should take a rest from this forum
Unable to test but that should display "123.46" where you had the cursor positioned in the current font and color. Is it clear now? If not, try explaining what part you don't understand.
thank's a lot avr_fred and olikraus! must be annoying to you experts to answer 'stupid' questions.
It's not annoying, as long as you would read the manual: "u8g2.print(50,60,myFloat,2);" will not work.
You must use "u8g2.setCursor(50,60); u8g2.print(myFloat,2);" as described in the manual.
as a beginner I was stuck too by the u8g2.print command, because the compiler refused with the annoying message that "...yxz was not declared".
... BUT the Serial.print command showed the desired output(float) in the serial monitor???