B4R Question Number representations

JMB

Active Member
Licensed User
Longtime User
Hi.

I am trying to convert some Arduino C code to B4R

How do I represent binary and hex numbers in the B4X world?

For example, I have this sort of variable defined in C...

unsigned long N_Register = 0b00000000000000000111101010000001;

How would I put this into B4X convention? I want to keep the binary representation in my code.

How would I represent a hex number?

Thanks for any help.

JMB
 
I think the best you can do is...

Code:
Private N_Register=0x‭7A81‬ As ULong
Log(Bit.ToBinaryString(N_Register) 'to verify bits
 
Upvote 0
Hi Kolbe, thanks for that. It appears from looking elsewhere that it isn't possible to define numbers as binary.

Thank you for your suggestion.

JMB
 
Last edited:
Upvote 0
Back
Top