wrong answer when makin hex --> binary conversion.

Hello,
i was wondering if someone could help me out :slight_smile:

so i was experimenting with conversion of value's

i tried to turn 5FFF hex into a binairy number that gave me 100011001000110

to see if this was right i put 5FFF in a online hex to binary converter and that gave me:
0101111111111111

this one must be right since i need 16 bits for my project.

ow and when i tried to make a hex from that binary number it gave me 3130

so the serial monitor can't display letters or?

i am not new to the arduino, i am no pro either so just learning :slight_smile:

any help would be appreciated,
and thanks in advance ! :slight_smile:

void setup() {
  // put your setup code here, to run once:

  
  Serial.begin(9600);
  Serial.println('5FFF', BIN);
  delay(1000);
  Serial.println(100011001000110, HEX);

}

void loop() {
  // put your main code here, to run repeatedly: 
  
}

Serial.println('5FFF', BIN);
delay(1000);
Serial.println(100011001000110, HEX);

The first print has a multichacter constant as parameter (not a string), the second has a large decimal number as parameter.
What did you intend?

0x5FFF is the normal way of writing a hex constant. No quotes.
0b100011001000110 is one way of writing a binary constant.

0100 is an octal constant.

Why do you want to convert them? They are stored as a bit pattern and it is only when you want to print it out do you need to specify a pretty format. And the print statement will do that for you.
Serial.Print(0x5FFF, BIN);
Will print out the hex value of 5FFF in binary.

yes i see thank you guys i didn't know that :stuck_out_tongue: i learned something now.
i tried to look it up but could really find any answers,

was just experimenting away with the serial monitor and how to change the notation of a value.
experimenting give's me new idea's for project's anyways :stuck_out_tongue:

experimenting give's me new idea's for project's

You are aware that in English when you make a word plural, it is not necessary (or correct) to use an apostrophe? The apostrophe generally indicates ownership, not plurality.

The apostrophe generally indicates ownership, not plurality.

...and also elision (e.g. "isn't" == "is not")

i know i use that ' to much,
you can understand what i'm saying right? :stuck_out_tongue:

Yes but it makes you seem less intelligent that you probably are.