For some context, I am using an program for the Arduino that uses byte formatted values like this: B10101010 and I am attempting to create a function that takes the first 8 values of an array like this [1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1] and converts it to the byte format shown above. My question is what is the simplest way to do this in C++? I hope the phrasing of the question makes sense. This is the format of the function that I want to enter the code into:
void bit_write (byte pins[]) {
}
B10101010) format. I think the size of the array can be found just by using thesizeofcommand. And by the way, the array passed in will always be that same size. Sorry that I didn't clarify this in the post