Hi guys. I am building an easy and not fast 8bit communication protocol. I need to get from an array like BYTE[8] the8 values and compose a an ordered byte like '10100110'.
Pseudo-code:
int BYTE[8] = {1,0,1,0,0,0,1,0}
//I have to trasform BYTE[] in
byte Mybyte = 10100010;
Solved this I can start to see communicated letters from an arduino to another
. Now I can only see bits 
Why does your 9 value array only have 8 elements in it?
Uhmm the zero indexing Arrrr
sorry. I fix the mistake thanks
Have you a solution for that I can't find nothing similar on the net (probably i don't know the terminology for an array operation like that)
Okay, think about this, see if this will work for you:
Sender:
for (x=0; x<8; x=x+1){
Serial.print (byte[x]); // send out byte[0] to byte[7]
}
Idea is that Char's are sent out that represent the bits. 0x30 = 1, 0x31 = 1
See asciitable.com
Receiver:
if (Serial.available()>7){ // 8 characters received?
for (x=0; x<8; x=x+1){
incomingByte = Serial.read(); // read them
hexValue = incomingByte - 0x30; // convert from char to hex value (0 or 1)
Mbyte = hexValue <x; // shift the bits into position, assume MSB comes in first - if not, change Send order from 7 to 0 vs 0 to 7
}
// idea is that byte is received, converted from a Char to hex, then shifted into position in the Mbyte
I save my BITS with an array: BITsReceived[BITcount] inside this I have the bits and their order.
Now I have to trasform this array in a byte, ordering the values following the index.
Like: "build a number composed by: first char first element of the array, second char, second element of the array and so on..."
Yes, I understand that, I think that's what I wrote so you can send it between 2 devices using the serial line.
Did you want to send some other way?