I’m having trouble printing a numeric variable, I’ve tried this method:
float score = 64;
text(score, 10, 10);
I tried using the str(n) as well but no luck there.
I’m having trouble printing a numeric variable, I’ve tried this method:
float score = 64;
text(score, 10, 10);
I tried using the str(n) as well but no luck there.
Need more info?
On a Pi or a PICO or other device?
From Python, Micro Python etc?
Posting the full code your using would help a lot.
Sorry, Picosystem, C++
I was able to use str(n)
with text
in the PicoSystem project I’m working on; if I pull that code out into the hello world example, it looks like so:
uint8_t world_x = 0;
uint8_t world_y = 5;
void draw(uint32_t tick) {
pen(0, 0, 0);
clear();
pen(15, 15, 15);
text(str((float)world_x, 0), 96, 112);
text(",", 104, 112);
text(str((float)world_y, 0), 112, 112);
}
And displays 0, 5
in the bottom right corner of the screen.
Are you having trouble at the compilation stage or in what’s being displayed on screen?
Thanks, I’ll try this ASAP. I was having trouble with the Syntax.
The decimal places says optional in the docs - so I didn’t think I needed it.
Man, I’m glad you’re here, support is nonexistent! :)
Glad to share what I’ve learned along the way :)