Go Down

Topic: decimal to binary (Read 632 times) previous topic - next topic

pranoy

hi guys


           i am new to arduino so pls help
           how can we convert decimal to binary and output it serially through a pin???????????

johnwasser

By 'decimal' do you mean a number like 23 or a string of digits like "23"?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

pranoy


Arrch

Decimal and binary are simply visual representations of the data; the Arduino doesn't know the difference unless it is trying to store as the visual representation (ASCII). If you want to say, display the binary number 23 on 8 digital pins, then you would simply need to use bitRead() to extract the individual bits and set the pins accordingly.

I feel like you've asked this before and we already answered it.

robtillaart

Quote
how can we convert decimal to binary and output it serially through a pin???????????

this way - http://arduino.cc/en/Tutorial/ShiftOut -

(and yes there are dozens of other ways)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

AWOL

Quote
how can we convert decimal to binary and output it serially through a pin???

(Is there something wrong with your "?" key?)

Code: [Select]
Serial.print (23, BIN); would seem to me to fit the specification.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up