JMB Active Member Licensed User Longtime User Jun 30, 2017 #1 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
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
kolbe Active Member Licensed User Longtime User Jul 1, 2017 #2 I think the best you can do is... B4X: Private N_Register=0x7A81 As ULong Log(Bit.ToBinaryString(N_Register) 'to verify bits Upvote 0
I think the best you can do is... B4X: Private N_Register=0x7A81 As ULong Log(Bit.ToBinaryString(N_Register) 'to verify bits
JMB Active Member Licensed User Longtime User Jul 1, 2017 #3 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: Jul 1, 2017 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