I´m trying to insert a binary raw sequence (01010100, 01101000, 01100001) into Arduino. I would like to make 8-led group blink in a loop, showing with light each 8-group binary sequence when: 0=light off and 1=light on.

It´s possible to do this operation with Arduino-uno ?

  • i don't think binary is supported in arduino, but you could use bitwise operators with the decimal values of these binaries
    – razzak
    Commented Jun 22, 2015 at 3:56
  • 1
    You should be able to do what you are asking, however your question is not very clear. Are you asking how you would turn on/off the LEDs based on the binary value of a variable, or how you would get the raw sequence into the Arduino/source code? Or both? How are you wanting to get the sequence into the Arduino? Is it to be pre-scripted in the source code, stored on some external device (such as an SD card), input by a user from some other hardware (such as a keypad) or transmitted (either wirelessly or via a serial connection)? Commented Jun 22, 2015 at 7:25
  • @razzak: Binary not being supported by Arduino is the silliest statement I ever heard about this platform. Almost everything inside the Arduino is binary. Decimal is only used for I/O, and only because we, humans, like it better that binary. Commented Jun 22, 2015 at 8:36
  • @EdgarBonet i was talking about using binary literals not the operations at the cpu level, you can not do int x = 01001001; in arduino. You can however use binary special notation (formatter) like int x = B01001001; which is not actual binary but rather a predefined decimal like doing #define B01001001 73.
    – razzak
    Commented Jun 22, 2015 at 18:43
  • Then, in your initial comment, you failed to make clear what you were talking about. The “B” notation is, in actual practice not that different from “0x” for hex. Or even decimal, which is only a notation after all: you do not really care whether it is interpreted by the preprocessor or the compiler proper. Commented Jun 22, 2015 at 19:08

1 Answer 1


You just prepend the number in binary with B e.g. B01100100 which is 100 in decimal

byte sequence[] = {

And to check the n-th bit from the right in a number you do

boolean bit_set = number & (1 << (n - 1)) != 0;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.