I’m trying to turn the array “hello”, with the DEC values of the characters used being: 56, 53, 60, 60, 63 and the array I’m trying to therefore obtain is: “0110100001100101011011000110110001101111” (the values of each character has 8 bits, starting with 0).

What I have written so far is:

```
int v[256];
char c[] = "hello";
int ascii_dec, int = 0, k = 0, j = 0;
while (c[i] != '\0') {
ascii_dec = c[i] - '0';
Serial.println(ascii_dec);
v[k] = 0;
++k;
for (j = 7; j > 0; j--) {
v[k] = bitRead(ascii_dec, j);
Serial.print(" Bit is: ");
Serial.print(v[k]);
Serial.print(" and k is: ");
Serial.print(k);
Serial.print(" ---- ");
++k;
}
Serial.print("\n");
++i;
}
for (i = 0; i < 40; i++) {
Serial.print(v[i]);
}
```

I have assumed that each value is represented on 7 bits.

The output is (I have ommited printing the first ‘0’ I’m trying to add in order to obtain the value on 8 bits):

56

Bit is: 0 and k is: 1 ---- Bit is: 0 and k is: 2 ---- Bit is: 1 and k is: 3 ---- Bit is: 1 and k is: 4 ---- Bit is: 1 and k is: 5 ---- Bit is: 0 and k is: 6 ---- Bit is: 0 and k is: 7 ----

53

Bit is: 0 and k is: 9 ---- Bit is: 0 and k is: 10 ---- Bit is: 1 and k is: 11 ---- Bit is: 1 and k is: 12 ---- Bit is: 0 and k is: 13 ---- Bit is: 1 and k is: 14 ---- Bit is: 0 and k is: 15 ----

60

Bit is: 0 and k is: 17 ---- Bit is: 0 and k is: 18 ---- Bit is: 1 and k is: 19 ---- Bit is: 1 and k is: 20 ---- Bit is: 1 and k is: 21 ---- Bit is: 1 and k is: 22 ---- Bit is: 0 and k is: 23 ----

60

Bit is: 0 and k is: 25 ---- Bit is: 0 and k is: 26 ---- Bit is: 1 and k is: 27 ---- Bit is: 1 and k is: 28 ---- Bit is: 1 and k is: 29 ---- Bit is: 1 and k is: 30 ---- Bit is: 0 and k is: 31 ----

63

Bit is: 0 and k is: 33 ---- Bit is: 0 and k is: 34 ---- Bit is: 1 and k is: 35 ---- Bit is: 1 and k is: 36 ---- Bit is: 1 and k is: 37 ---- Bit is: 1 and k is: 38 ---- Bit is: 1 and k is: 39 ----

0001110000011010000111100001111000011111

So… it doesn’t seem to do what I’m trying to. Does anyone have any idea why?