Skip to content

Display a "Non-integer"-Value with Berry in HASPmote #23575

Answered by s-hadinger
patpommi asked this question in Q&A
Discussion options

You must be logged in to vote

To convert to floating point use real() instead of int()

The best way to control decimal is to use format

global.p1b12.text=format("%.2f", real(payload_s)) (which would give you 2 decimals).

You can also use f-string syntax:

global.p1b12.text=f"{real(payload_s):.2f}"

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@sfromis
Comment options

@patpommi
Comment options

Answer selected by patpommi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants