char array to binary and then to digitalWrite

Hello,

I would like to do this:

I have a char array, say:
char *myarray = "ciao"

I want to iterate over each char, convert it to binary and use this binary code to DigitalWrite(HIGH or LOW) a particular pin.
Each bit is a HIGH or a LOW

I think that the proper code would use binary shifting and should be simple.. I ask for someone more expert than me on the topic.

A code example would be appreciated

Thank you,
robse

Clarification please

Exactly what would the digital output be for 'c' ?

I want to iterate over each char, convert it to binary

They already are binary.
No conversion necessary

I think that the proper code would use binary shifting and should be simple..

[u]bitRead()[/u] will read one bit at a time so you can read a bit and then write it with digitalWrite().

Sometimes this is called "bit banging".

And of course, you can read/write one array element (one character) at time.

And, you might want to "print out" the binary values for testing/debugging.

For example, [u]ASCII[/u] 'c' is 99 (decimal) = 63 (hex) = 01100011 (binary)

This is the coded I needed, thank you

char *inputline = "ciao";
int d,w;

for(d=0;d<strlen(inputline); d++) {
  for(w=0; w<8; w++) {
      Serial.print(bitRead(inputline[d], w));
// 
//    digitalWrite(10, bitRead(inputline[d], w));
//
  }
}