       Keyboard.release(prevCharacter);
       prevCharacter = character;
       if (character != 0) {
+        Serial.println(character);
         Keyboard.press(character);
-      }
+      } 
     }
   }
 }
-

  if (input & 1) {
    switch(input){
      case B000001:
        toggleKey(KEY_LEFT_SHIFT);
        return 0;
      case B111101:
        resetState();

  PORTB |= B11111111;

  Keyboard.begin();
  Serial.begin(9600);
}

char readButtons() {
  return (~(PINB)) & B00111111;
}

void toggleKey(char key) {
  if (!toggles[key ^ 80]) {
    toggles[key ^ 80] = true;
    Keyboard.press(key);
  } else {
    toggles[key ^ 80] = false;
    Keyboard.release(key);
  }
}
