   printChar('l',25);
   printChar('e',30);  
   printChar('k',35);    
+  printChar('j',40);    
+  printChar('e',45);    */ 
+  char tekst[29] = "Maakplek";
+  printString(tekst, 0, activebuffer);
 }
 
 void loop() {
+  unsigned long currentMillis = millis();
+  
+  if(currentMillis - previousMillis > interval) {
+    // save the last time you blinked the LED 
+    previousMillis = currentMillis;   
+    // if the LED is off turn it on and vice-versa:
+    //updatebuffer();
+
+  }  
   updatescreen();
-  updatebuffer();
-}
+
+  communicate();
+}
+
+void communicate () {
+  // send data only when you receive data:
+  if (Serial.available() > 0) {
+    // read the incoming byte:
+    incomingByte = Serial.read();
+ 
+    printChar(incomingByte, incomingPos, activebuffer);
+    incomingPos = incomingPos + 5;
+    if (incomingPos > 28*5) {
+              incomingPos = 0;
+    }
+  }
+}
+        
 
 void updatescreen() {
   // 7 rows
   for (int i=0 ; i < 7; i++) {
 
-    // Update row.
-    shiftOut(dataPin, clockPin, LSBFIRST, screenbuffer[activebuffer][i][1]);    
+    
+/*    shiftOut(dataPin, clockPin, LSBFIRST, screenbuffer[activebuffer][i][1]);    
     shiftOut(dataPin, clockPin, LSBFIRST, screenbuffer[activebuffer][i][0]); 
     shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][0] >> 8)); 
     shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][0] >> 16));
-    shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][0] >> 24)); 
+    shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][0] >> 24)); */
     
+    // Update row.
+    for (int j = 5; j >= 0; j--) {
+      shiftOut(dataPin, clockPin, LSBFIRST, screenbuffer[activebuffer][i][j]); 
+      shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][j] >> 8)); 
+      shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][j] >> 16));
+      shiftOut(dataPin, clockPin, LSBFIRST, (screenbuffer[activebuffer][i][j] >> 24)); 
+    }
+
     // Turn off row.
     if (i == 0) {
       digitalWrite(19, 1);

  }
}

void printString();

void printChar(char ch, byte pos)
{  
  // The display is 40 bits wide, the buffer only 32. Time to select the correct one.
  int bufferpos = 0;
  int bufferlength = 31;  
  int bufferpointer = 0;
  
  // make sure the character is within the alphabet bounds (defined by the font.h file)
  // if it's not, make it a blank character

int clockPin = 11;
int dataPin = 12;

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;

void setup() {
 pinMode(latchPin, OUTPUT);
