I have a lot of code for driving a VFD display, it uses SPI to communicate, I chose to use the "ShiftOut()" Arduino function which works really well. I already set up code to convert a string into its binary representation, the very specific problem I'm having has to do with how that binary data is coming out. For example I can do PrintString("Hello"); but what I get from bitRead(); is a continuous LONG line of binary that's obviously more than 8-bits and that's not going to work with ShiftOut();
So the question then is, if you had a long continuous streaming line of binary data coming in, how would you chop it up into 8-bit sections, and feed it into ShiftOut(); to send it out?
Note: You'll notice the ASCII binary data for the letters are reversed, I purposely set it up this way
Here's the relevant code:
void PrintString(String l){
digitalWrite(sspin, LOW); //slave select pin
shiftOut(datapin, clockpin, bitorder, 0b00001000); //DCRAM command starting at COM1
for(int i=0; i<l.length(); i++){
char Character = l.charAt(i);
for(int k=0; k<8; k++){
bitsofCharacter = bitRead(Character, k);
Serial.print(bitsofCharacter); //for debugging, look at the long line of binary here
}
}
digitalWrite(sspin, HIGH);
}