binary to an array in C
ok I've got my spi working, but I am wondering how I can turn a binary number into an array of same numbers i.o.w.
how to make this: 0b10110100
into this
binarray[0] = 1
binarray[1] = 0
binarray[2] = 1
binarray[3] = 1
binarray[4] = 0
binarray[5] = 1
binarray[6] = 0
binarray[7] = 0
...so i can assign the individual numbers to their appropriate output pins that aren't all on the same port.
ok I've got my spi working, but I am wondering how I can turn a binary number into an array of same numbers i.o.w.
how to make this: 0b10110100
into this
binarray[0] = 1
binarray[1] = 0
binarray[2] = 1
binarray[3] = 1
binarray[4] = 0
binarray[5] = 1
binarray[6] = 0
binarray[7] = 0
...so i can assign the individual numbers to their appropriate output pins that aren't all on the same port.
Last edited: