50 bits ?
32 bits ?
Which is it ?
Try this
byte dataArray[] = {0, 0, 0, 0, 0, 0, 0, 0};
byte setThisBit = 0;
void setup()
{
Serial.begin(115200);
Serial.println();
showBits();
setABit(0, 1);
showBits();
setABit(1, 1);
showBits();
setABit(1, 0);
showBits();
setABit(20, 1);
showBits();
}
void loop()
{
}
void showBits()
{
for (int theBytes = 0; theBytes < 8; theBytes++)
{
for (int theBits = 0; theBits < 8; theBits++)
{
Serial.print(bitRead(dataArray[theBytes], theBits));
Serial.print(" ");
}
Serial.println();
}
}
void setABit(byte bitToSet, byte bitValue)
{
byte theByte = bitToSet / 8;
Serial.print("byte : ");
Serial.println(theByte);
byte theBit = bitToSet % 8;
Serial.print("bit : ");
Serial.println(theBit);
bitWrite(dataArray[theByte], theBit, bitValue);
}
Does it do any of what you want ?