 int clockPin = 11;
 int dataPin = 12;
 
-unsigned long screenbuffer[2][7][2];
+unsigned long screenbuffer[2][7][5];
+
+long interval = 1000;           // interval at which to 'hop' (milliseconds)
+unsigned long previousMillis = 0;
+
+int incomingByte = 0;   // for incoming serial data
+int incomingPos = 0;
 
 byte activebuffer = 0;
 byte passivebuffer = 1;
-
-unsigned long lastmilli;
 
 void setup() {
  pinMode(latchPin, OUTPUT);

screenbuffer[activebuffer][4][0] = 0x37BD1;
screenbuffer[activebuffer][5][0] = 0x54631;
screenbuffer[activebuffer][6][0] = 0x97BD1;*/
  printChar('H',0);
  printChar('a',5);
  printChar('a',10);
  printChar('k',15);

  // subtract the space character (converts the ASCII number to the font index number)
  ch -= 32;
  // step through each byte of the character array
  for (int charCol=0; charCol<5; charCol++) {
    byte b = font[ch][charCol];

    bufferpointer = (charCol+charPos)/32;
    bufferpos = charPos - (32 * bufferpointer);
        
    //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
    // 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 
    //                                                                                                 31 30 29 28 27 26 25 24
    //                                                                                                  7  6  5  4  3  2  1  0

    
    // bit shift through the byte, set it in the buffer
    for (int row=0; row<7; row++) {
      if (b & (1 << row)) {        
        bitSet(screenbuffer[activebuffer][row][bufferpointer], 31-charCol-bufferpos);
      }
      else {
        bitClear(screenbuffer[activebuffer][row][bufferpointer], 31-charCol-bufferpos);
      }
    }
  }
}

void printString(char* source, byte pos, char bufferpointer) {
  int i;
  for (i = 0; i < strlen(source); i++){
    printChar(source[i], pos+i*5, bufferpointer);
  }
}

void updatebuffer() {
  for (int col=0; col<=4; col++) {
    for (int row=0; row<7; row++) {
      screenbuffer[passivebuffer][row][col] = screenbuffer[activebuffer][row][col-1];
      /*if (b & (1 << row)) {        
        bitSet(screenbuffer[activebuffer][row][bufferpointer], 31-charCol-bufferpos);
      }
      else {
        bitClear(screenbuffer[activebuffer][row][bufferpointer], 31-charCol-bufferpos);
      }     */ 
    }
  }
  switchbuffer();
}

void switchbuffer() {
  activebuffer = activebuffer xor passivebuffer;
  passivebuffer = activebuffer xor passivebuffer;
  activebuffer = activebuffer xor passivebuffer;
}
