I actually just had moved to the idea of a char array just before you posted this.
I have it working with the char array, but don’t know how I would write it to the virtual pin.
CODE:
char storage[6];
void setup() {
Serial.begin(9600);
for (int j = 0; j < 6; j++) {
for (int i = 0; i < 8; i++) {
bitWrite(storage[j], i, i % 2);
}
}
for (int j = 0; j < 6; j++) {
for (int i = 0; i < 8; i++) {
Serial.print(j*8 + i);
Serial.print(": ");
Serial.print(i % 2);
Serial.print(", ");
Serial.println(bitRead(storage[j], i));
}
}
}
void loop() {
// put your main code here, to run repeatedly:
}
SERIAL OUT:
0: 0, 0
1: 1, 1
2: 0, 0
3: 1, 1
4: 0, 0
5: 1, 1
6: 0, 0
7: 1, 1
8: 0, 0
9: 1, 1
10: 0, 0
11: 1, 1
12: 0, 0
13: 1, 1
14: 0, 0
15: 1, 1
16: 0, 0
17: 1, 1
18: 0, 0
19: 1, 1
20: 0, 0
21: 1, 1
22: 0, 0
23: 1, 1
24: 0, 0
25: 1, 1
26: 0, 0
27: 1, 1
28: 0, 0
29: 1, 1
30: 0, 0
31: 1, 1
32: 0, 0
33: 1, 1
34: 0, 0
35: 1, 1
36: 0, 0
37: 1, 1
38: 0, 0
39: 1, 1
40: 0, 0
41: 1, 1
42: 0, 0
43: 1, 1
44: 0, 0
45: 1, 1
46: 0, 0
47: 1, 1
That all works fine, although I am yet to find anyway to turn that to a string.