Go Down

Topic: bit writer require help (Read 6748 times) previous topic - next topic

AWOL

Quote
Actually was 85 in decimal

So, not 0x55?
Damn.
"Pete, it's a fool (who) 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.
I speak for myself, not Arduino.

steinie44

#16
Jul 09, 2014, 09:24 pm Last Edit: Jul 09, 2014, 09:29 pm by steinie44 Reason: 1
Says Who?

Quote
I am trying to create bytes, but i keep getting 28(11100) when im expecting 170(10101010).

The OP is using Decimal and binary, No Hex!


Onmt39

#17
Aug 31, 2014, 01:01 pm Last Edit: Aug 31, 2014, 01:14 pm by Onmt39 Reason: 1
thank you steinie44 i tested you code and worked well
I cant understand this though
Code: [Select]

for (byte i = 7; i < 8; i--)
 {
   bitWrite(b, i, bits[j]);j++;
 }

I understand 'for' with the initialize, test and increment, i just don't know what is happening.

Also how would I change the individual bits without requiring to change everything.
eg. (i didn't know how else to say it)
Code: [Select]

if (door is open){
bit3 = 1
}
if(door is closed){
bit3 = 0
}

AWOL

"Pete, it's a fool (who) 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.
I speak for myself, not Arduino.

Go Up